diff options
author | Neil Johnson <neil@matrix.org> | 2020-03-06 18:14:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-06 18:14:19 +0000 |
commit | 1d66dce83e58827aae12080552edeaeb357b1997 (patch) | |
tree | f630ac8cc3e9d2730fea97a5850c2bb2d3c3efb7 /synapse/app/homeserver.py | |
parent | Convert remote key resource REST layer to async/await. (#7020) (diff) | |
download | synapse-1d66dce83e58827aae12080552edeaeb357b1997.tar.xz |
Break down monthly active users by appservice_id (#7030)
* Break down monthly active users by appservice_id and emit via prometheus. Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
Diffstat (limited to 'synapse/app/homeserver.py')
-rw-r--r-- | synapse/app/homeserver.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index c2a334a2b0..e0fdddfdc9 100644 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -298,6 +298,11 @@ class SynapseHomeServer(HomeServer): # Gauges to expose monthly active user control metrics current_mau_gauge = Gauge("synapse_admin_mau:current", "Current MAU") +current_mau_by_service_gauge = Gauge( + "synapse_admin_mau_current_mau_by_service", + "Current MAU by service", + ["app_service"], +) max_mau_gauge = Gauge("synapse_admin_mau:max", "MAU Limit") registered_reserved_users_mau_gauge = Gauge( "synapse_admin_mau:registered_reserved_users", @@ -585,12 +590,20 @@ def run(hs): @defer.inlineCallbacks def generate_monthly_active_users(): current_mau_count = 0 + current_mau_count_by_service = {} reserved_users = () store = hs.get_datastore() if hs.config.limit_usage_by_mau or hs.config.mau_stats_only: current_mau_count = yield store.get_monthly_active_count() + current_mau_count_by_service = ( + yield store.get_monthly_active_count_by_service() + ) reserved_users = yield store.get_registered_reserved_users() current_mau_gauge.set(float(current_mau_count)) + + for app_service, count in current_mau_count_by_service.items(): + current_mau_by_service_gauge.labels(app_service).set(float(count)) + registered_reserved_users_mau_gauge.set(float(len(reserved_users))) max_mau_gauge.set(float(hs.config.max_mau_value)) |