Skip to content

Commit 2d07bd7

Browse files
Update TODO list of conflicting areas where we encounter metrics being clobbered (ApplicationService) (#19040)
These errors are harmless and are a long-standing issue that is just now being logged, see #19042 ``` 2025-10-10 15:30:00,026 - synapse.util.metrics - 330 - ERROR - notify_interested_services-0 - Metric named cache_lru_cache__matches_user_in_member_list_example.com already registered for server example.com 2025-10-10 16:30:00.167 2025-10-10 15:30:00,026 - synapse.util.metrics - 330 - ERROR - notify_interested_services-0 - Metric named cache_lru_cache_is_interested_in_room_example.com already registered for server example.com 2025-10-10 16:30:00.167 2025-10-10 15:30:00,025 - synapse.util.metrics - 330 - ERROR - notify_interested_services-0 - Metric named cache_lru_cache_is_interested_in_event_example.com already registered for server example.com 2025-10-10 16:29:15.560 2025-10-10 15:29:15,449 - synapse.util.metrics - 330 - ERROR - notify_interested_services_ephemeral-0 - Metric named cache_lru_cache__matches_user_in_member_list_example.com already registered for server example.com 2025-10-10 16:29:15.560 2025-10-10 15:29:15,449 - synapse.util.metrics - 330 - ERROR - notify_interested_services_ephemeral-0 - Metric named cache_lru_cache_is_interested_in_room_example.com already registered for server example.com ```
1 parent a7303c5 commit 2d07bd7

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

changelog.d/19040.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update TODO list of conflicting areas where we encounter metrics being clobbered (`ApplicationService`).

synapse/util/metrics.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,13 @@ def register_hook(
323323
if server_hooks.get(metric_name) is not None:
324324
# TODO: This should be an `assert` since registering the same metric name
325325
# multiple times will clobber the old metric.
326-
# We currently rely on this behaviour as we instantiate multiple
327-
# `SyncRestServlet`, one per listener, and in the `__init__` we setup a new
328-
# LruCache.
326+
#
327+
# We currently rely on this behaviour in a few places:
328+
# - We instantiate multiple `SyncRestServlet`, one per listener, and in the
329+
# `__init__` we setup a new `LruCache`.
330+
# - We instantiate multiple `ApplicationService` (one per configured
331+
# application service) which use the `@cached` decorator on some methods.
332+
#
329333
# Once the above behaviour is changed, this should be changed to an `assert`.
330334
logger.error(
331335
"Metric named %s already registered for server %s",

0 commit comments

Comments
 (0)