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 https://github.com/element-hq/synapse/issues/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
```
This commit is contained in:
Eric Eastwood 2025-10-13 10:15:47 -05:00 committed by GitHub
parent a7303c5311
commit 2d07bd7fd2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

1
changelog.d/19040.misc Normal file
View File

@ -0,0 +1 @@
Update TODO list of conflicting areas where we encounter metrics being clobbered (`ApplicationService`).

View File

@ -323,9 +323,13 @@ class DynamicCollectorRegistry(CollectorRegistry):
if server_hooks.get(metric_name) is not None:
# TODO: This should be an `assert` since registering the same metric name
# multiple times will clobber the old metric.
# We currently rely on this behaviour as we instantiate multiple
# `SyncRestServlet`, one per listener, and in the `__init__` we setup a new
# LruCache.
#
# We currently rely on this behaviour in a few places:
# - We instantiate multiple `SyncRestServlet`, one per listener, and in the
# `__init__` we setup a new `LruCache`.
# - We instantiate multiple `ApplicationService` (one per configured
# application service) which use the `@cached` decorator on some methods.
#
# Once the above behaviour is changed, this should be changed to an `assert`.
logger.error(
"Metric named %s already registered for server %s",