mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-12 18:12:10 -04:00
Correctly initialise the synapse_user_logins
metric. (#10677)
Fix a bug where the prometheus metrics for SSO logins wouldn't be initialised until the first user logged in with a given auth provider.
This commit is contained in:
parent
86415f162d
commit
15db8b7c7f
4 changed files with 44 additions and 6 deletions
|
@ -56,6 +56,22 @@ login_counter = Counter(
|
|||
)
|
||||
|
||||
|
||||
def init_counters_for_auth_provider(auth_provider_id: str) -> None:
|
||||
"""Ensure the prometheus counters for the given auth provider are initialised
|
||||
|
||||
This fixes a problem where the counters are not reported for a given auth provider
|
||||
until the user first logs in/registers.
|
||||
"""
|
||||
for is_guest in (True, False):
|
||||
login_counter.labels(guest=is_guest, auth_provider=auth_provider_id)
|
||||
for shadow_banned in (True, False):
|
||||
registration_counter.labels(
|
||||
guest=is_guest,
|
||||
shadow_banned=shadow_banned,
|
||||
auth_provider=auth_provider_id,
|
||||
)
|
||||
|
||||
|
||||
class LoginDict(TypedDict):
|
||||
device_id: str
|
||||
access_token: str
|
||||
|
@ -96,6 +112,8 @@ class RegistrationHandler(BaseHandler):
|
|||
self.session_lifetime = hs.config.session_lifetime
|
||||
self.access_token_lifetime = hs.config.access_token_lifetime
|
||||
|
||||
init_counters_for_auth_provider("")
|
||||
|
||||
async def check_username(
|
||||
self,
|
||||
localpart: str,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue