fix(authentication): reconcile logged in users metric#1468
Open
it2022031 wants to merge 7 commits into
Open
Conversation
kkopanidis
requested changes
May 8, 2026
Contributor
kkopanidis
left a comment
There was a problem hiding this comment.
Unnecessary duplication present. The "provideUserTokens" function can be utilized to call the "addLoggedInUser" and "reconcileLoggedInUserMetric", instead of adding it everywhere in the code
ChrisPdgn
requested changes
May 8, 2026
ChrisPdgn
approved these changes
May 11, 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.
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
The PR fulfills these requirements:
mainbranchfix #xxx, where "xxx" is the issue number)If adding a new feature, the PR's description includes:
Other information:
This PR improves the accuracy of the
logged_in_users_totalauthentication metric.Previously, the metric could become inconsistent because expired sessions were not always removed correctly when tokens expired naturally over time. As a result,
logged_in_users_totalcould temporarily report incorrect values.Additionally, the metric was effectively tracking active tokens instead of unique logged-in users, meaning the same user could be counted multiple times across different sessions.
This PR centralizes logged-in user metric updates in
TokenProviderand improves cleanup/reconciliation logic so the metric reflects unique active logged-in users more reliably across authentication flows, token refreshes, session invalidation, and expired token cleanup.No breaking changes are introduced.