-
Notifications
You must be signed in to change notification settings - Fork 404
Refactor Histogram metrics to be homeserver-scoped
#18724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
MadLittleMods
merged 27 commits into
develop
from
madlittlemods/18592-refactor-histogram
Jul 29, 2025
Merged
Refactor Histogram metrics to be homeserver-scoped
#18724
MadLittleMods
merged 27 commits into
develop
from
madlittlemods/18592-refactor-histogram
Jul 29, 2025
+262
−89
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 tasks
Fix `synapse/federation/federation_server.py`
Wait for #18656 to be merged so we have `self.server_name` available.
``` synapse/metrics/__init__.py:522: error: Expected the `labelnames` argument of Histogram to be a list of label names (including `SERVER_NAME_LABEL`), but got TupleExpr:528( StrExpr(type) StrExpr(reason) NameExpr(SERVER_NAME_LABEL [synapse.metrics.SERVER_NAME_LABEL])). If this is a process-level metric (vs homeserver-level), use a type ignore comment to disable this check. [missing-server-name-label] ```
Wait for #18656 to merge so we have access to `self.server_name`
75ead73 to
4b0a4bb
Compare
Conflicts: scripts-dev/mypy_synapse_plugin.py synapse/http/request_metrics.py synapse/replication/tcp/external_cache.py synapse/storage/database.py
Conflicts: scripts-dev/mypy_synapse_plugin.py synapse/metrics/_gc.py
devonh
reviewed
Jul 29, 2025
devonh
approved these changes
Jul 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes all look pretty straightforward and use the same patterns as the other metrics changes. 👍
...assuming CI passes of course :)
|
Thanks for the review @devonh 🦩 |
3 tasks
MadLittleMods
added a commit
that referenced
this pull request
Jul 30, 2025
Same changelog as #18724 so they merge
MadLittleMods
added a commit
that referenced
this pull request
Jul 31, 2025
```
Failed to stop metrics: TypeError("prometheus_client.metrics.MetricWrapperBase.labels() got multiple values for keyword argument 'server_name'")
```
Noticed while running and debugging some tests.
This bug was introduced in
#18724
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bulk refactor
Histogrammetrics to be homeserver-scoped. We also add lints to make sure that newHistogrammetrics don't sneak in without using theserver_namelabel (SERVER_NAME_LABEL).Part of #18592
Testing strategy
metricslistener in yourhomeserver.yamlpoetry run synapse_homeserver --config-path homeserver.yamlhttp://localhost:9322/_synapse/metricsand/orhttp://localhost:9323/metricsserver_namelabelTodo
Countermetrics to be homeserver-scoped #18656 to mergeDev notes
Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.