Skip to content

Provide more specific password login failure reasons in metrics - #5862

Open
reivilibre wants to merge 3 commits into
mainfrom
rei/better_login_fail_reasons
Open

reivilibre wants to merge 3 commits into
mainfrom
rei/better_login_fail_reasons

Conversation

@reivilibre

Copy link
Copy Markdown
Member

This is probably not ready to merge as-is, but I just got paged because we had a large rate of 'error' password logins.

Problem is, this seems to not be a very useful metric currently and it seems like it could just be someone hitting their ratelimit and spamming requests.

I'm opening this as a discussion starter, but we probably want to figure out what we actually want from the alerting on this one.

@reivilibre
reivilibre requested a review from a team as a code owner July 10, 2026 12:25
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

Deploying matrix-authentication-service-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0b9d97f
Status: ✅  Deploy successful!
Preview URL: https://1a6a718d.matrix-authentication-service-docs.pages.dev
Branch Preview URL: https://rei-better-login-fail-reason.matrix-authentication-service-docs.pages.dev

View logs


if !form_state.is_valid() {
tracing::warn!("Invalid login form: {form_state:?}");
PASSWORD_LOGIN_COUNTER.add(1, &[KeyValue::new(RESULT, "error")]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think to avoid breaking the existing metric, I would rather add a new label? like {result="error", reason="form-invalid"}? Most dashboard and alerting rules should anyway sum on (result) … or similar since MAS scales horizontally and usually has multiple instances, so adding cardinality with a new label isn't a breaking change

@reivilibre reivilibre Dec 1, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, though note result=mismatch is already a potential label. Having the split reason is going to feel a little bit inconsistent

@reivilibre
reivilibre requested a review from a team as a code owner December 1, 2026 15:31
@reivilibre
reivilibre requested review from barodeur and removed request for a team and barodeur December 1, 2026 15:31
# Conflicts:
#	crates/handlers/src/views/login.rs
@reivilibre
reivilibre requested a review from sandhose December 1, 2026 15:54

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants