Add metric to count number of non-deactivated users.#19848
Merged
Conversation
Half-Shot
commented
Jun 11, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Prometheus gauge (synapse_admin_user_count) intended to report total user counts (as a non-monthly counterpart to MAU), split by app_service.
Changes:
- Add
synapse_admin_user_countgauge and a 5-minute background task to populate it. - Add a datastore query to count non-deactivated users grouped by appservice.
- Add a test exercising the gauge update path and a Towncrier newsfragment.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
synapse/app/phone_stats_home.py |
Defines the new gauge and schedules a periodic update task. |
synapse/storage/databases/main/registration.py |
Adds get_user_count_by_service() SQL query used by the gauge updater. |
tests/metrics/test_phone_home_stats.py |
Adds a test asserting the gauge reflects deactivation. |
changelog.d/19848.feature |
Documents the new metric. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
3 tasks
MadLittleMods
added a commit
that referenced
this pull request
Jun 12, 2026
…ge (#19849) I.e. `default_config("test")` and `default_config("test", False)` are so opaque and hard to connect the dots with. Spawning from trying to figure out what the `server_name` is set as for our `HomeserverTestCase` in order to reference it in #19848 (comment)
Co-authored-by: Eric Eastwood <erice@element.io>
Co-authored-by: Eric Eastwood <erice@element.io>
Co-authored-by: Eric Eastwood <madlittlemods@gmail.com>
MadLittleMods
approved these changes
Jun 25, 2026
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
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.
This reports the total count of users (split by appservice) which is meant to be the monthless counterpart to the MAU metric.
Context: