mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-13 11:43:25 +01:00
improve naming
This commit is contained in:
parent
5cea4e16c7
commit
8decd6233d
4 changed files with 14 additions and 10 deletions
|
@ -1 +1 @@
|
|||
create synapse_admin_mau:reserved metric to expose number of real reaserved users
|
||||
Add synapse_admin_mau:registered_reserved_users metric to expose number of real reaserved users
|
||||
|
|
|
@ -307,7 +307,10 @@ class SynapseHomeServer(HomeServer):
|
|||
# Gauges to expose monthly active user control metrics
|
||||
current_mau_gauge = Gauge("synapse_admin_mau:current", "Current MAU")
|
||||
max_mau_gauge = Gauge("synapse_admin_mau:max", "MAU Limit")
|
||||
reserved_mau_gauge = Gauge("synapse_admin_mau:reserved", "Reserved real MAU users")
|
||||
registered_reserved_users_mau_gauge = Gauge(
|
||||
"synapse_admin_mau:registered_reserved_users",
|
||||
"Registered users with reserved threepids"
|
||||
)
|
||||
|
||||
|
||||
def setup(config_options):
|
||||
|
@ -533,12 +536,13 @@ def run(hs):
|
|||
@defer.inlineCallbacks
|
||||
def generate_monthly_active_users():
|
||||
current_mau_count = 0
|
||||
reserved_mau_count = 0
|
||||
reserved_count = 0
|
||||
store = hs.get_datastore()
|
||||
if hs.config.limit_usage_by_mau:
|
||||
current_mau_count = yield hs.get_datastore().get_monthly_active_count()
|
||||
reserved_mau_count = yield hs.get_datastore().get_reserved_real_user_account()
|
||||
current_mau_count = yield store.get_monthly_active_count()
|
||||
reserved_count = yield store.get_registered_reserved_users_count()
|
||||
current_mau_gauge.set(float(current_mau_count))
|
||||
reserved_mau_gauge.set(float(reserved_mau_count))
|
||||
registered_reserved_users_mau_gauge.set(float(reserved_count))
|
||||
max_mau_gauge.set(float(hs.config.max_mau_value))
|
||||
|
||||
hs.get_datastore().initialise_reserved_users(
|
||||
|
|
|
@ -147,7 +147,7 @@ class MonthlyActiveUsersStore(SQLBaseStore):
|
|||
return self.runInteraction("count_users", _count_users)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def get_reserved_real_user_account(self):
|
||||
def get_registered_reserved_users_count(self):
|
||||
"""Of the reserved threepids defined in config, how many are associated
|
||||
with registered users?
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ class MonthlyActiveUsersTestCase(HomeserverTestCase):
|
|||
|
||||
def test_get_reserved_real_user_account(self):
|
||||
# Test no reserved users, or reserved threepids
|
||||
count = self.store.get_reserved_real_user_account()
|
||||
count = self.store.get_registered_reserved_users_count()
|
||||
self.assertEquals(self.get_success(count), 0)
|
||||
# Test reserved users but no registered users
|
||||
|
||||
|
@ -201,7 +201,7 @@ class MonthlyActiveUsersTestCase(HomeserverTestCase):
|
|||
self.hs.config.mau_limits_reserved_threepids = threepids
|
||||
self.store.initialise_reserved_users(threepids)
|
||||
self.pump()
|
||||
count = self.store.get_reserved_real_user_account()
|
||||
count = self.store.get_registered_reserved_users_count()
|
||||
self.assertEquals(self.get_success(count), 0)
|
||||
|
||||
# Test reserved registed users
|
||||
|
@ -212,5 +212,5 @@ class MonthlyActiveUsersTestCase(HomeserverTestCase):
|
|||
now = int(self.hs.get_clock().time_msec())
|
||||
self.store.user_add_threepid(user1, "email", user1_email, now, now)
|
||||
self.store.user_add_threepid(user2, "email", user2_email, now, now)
|
||||
count = self.store.get_reserved_real_user_account()
|
||||
count = self.store.get_registered_reserved_users_count()
|
||||
self.assertEquals(self.get_success(count), len(threepids))
|
||||
|
|
Loading…
Reference in a new issue