Skip to content

Conversation

@MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Jul 30, 2025

Fix Failed to stop metrics warnings in request metrics

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

Testing strategy

  1. SYNAPSE_TEST_LOG_LEVEL=INFO poetry run trial tests.handlers.test_message
  2. Inspect _trial_temp/test.log to see any warnings/errors in the logs (search for Failed to stop metrics)

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct (run the linters)

```
Failed to stop metrics: TypeError("prometheus_client.metrics.MetricWrapperBase.labels() got multiple values for keyword argument 'server_name'")
```
@MadLittleMods MadLittleMods changed the title Fix Failed to stop metrics in request metrics Fix Failed to stop metrics warnings in request metrics Jul 30, 2025
Same changelog as #18724 so they merge
@@ -0,0 +1 @@
Refactor `Histogram` metrics to be homeserver-scoped.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same changelog as #18724 so they merge

@MadLittleMods MadLittleMods marked this pull request as ready for review July 30, 2025 20:52
@MadLittleMods MadLittleMods requested a review from a team as a code owner July 30, 2025 20:52
@MadLittleMods MadLittleMods merged commit a6e3265 into develop Jul 31, 2025
44 checks passed
@MadLittleMods MadLittleMods deleted the madlittlemods/fix-failed-to-stop-metrics branch July 31, 2025 15:31
@MadLittleMods
Copy link
Contributor Author

Thanks for the review @devonh 🦘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants