Skip to content

Count passkey adoption in the metrics gauges - #389

Merged
SiteRelEnby merged 3 commits into
mainfrom
feat/passkey-adoption-gauges
Nov 24, 2026
Merged

SiteRelEnby merged 3 commits into
mainfrom
feat/passkey-adoption-gauges

Conversation

@SiteRelEnby

Copy link
Copy Markdown
Contributor

Adds passkey adoption to the metrics gauges. sheaf_auth_totp_enabled has always answered "how many people use TOTP"; there was no equivalent for passkeys, only the sign-in outcomes on logins_total, which count ceremonies rather than people.

  • sheaf_auth_passkey_users: users holding at least one usable passkey. Users rather than credentials, because someone who enrols a phone and a laptop is one adopter.
  • sheaf_auth_passkey_credentials{usable="true"|"false"}: enrolled credentials, split on the same rule the passkeys API uses for its usable field (the credential's rp_id matches the instance's current relying-party ID). After a domain move the old credentials show up as going dark rather than as a collapse in adoption.
  • All three numbers come from one query, so they share a snapshot and the derived usable="false" count cannot dip below zero when an enrolment lands mid-refresh.
  • With no resolvable relying party (passkeys off, or a base URL with no usable host) the gauges are set to zero adopters and every credential unusable, rather than left at their last value.
  • METRICS.md documents both gauges, and the logins_total outcome list is brought back in line with the code: it was missing the account-standing refusals and the four passkey outcomes.

Verification

  • The four passkey login outcomes are present from the first scrape.
  • Both usable buckets are present after a gauge pass, and adopters never exceed usable credentials.
  • One account enrols two passkeys and one is moved to another relying-party ID: the API lists one usable and one not, and the gauges move by exactly one usable credential, one unusable credential and one adopter.
  • selfhosted/metrics passes. Ruff clean.

sheaf_auth_totp_enabled has always answered "how many people use TOTP",
with no equivalent for passkeys. The only passkey telemetry was the four
sign-in outcomes on logins_total, and those count ceremonies rather than
people: one person signing in daily from two devices moves them more than
ten people who enrolled a passkey and then mostly use a password.

Adds two gauges, filled by the existing gauge refresh:

  sheaf_auth_passkey_users        users holding at least one usable passkey
  sheaf_auth_passkey_credentials  credentials, by usable=true|false

Users is the headline number rather than credentials because somebody who
enrols a phone and a laptop is one adopter, not two.

`usable` carries the same meaning as the field of that name in the passkeys
API: a credential is bound forever to the relying-party ID it was enrolled
under, so after a domain move the rows that no longer match are still listed
to their owner but cannot sign anyone in. Splitting on it means such a move
reads as credentials going dark rather than as a collapse in adoption. The
total, usable and adopter counts come from one statement, so they share a
snapshot and the unusable count, derived by subtraction, cannot dip below
zero when an enrolment lands mid-refresh.

When no relying party resolves, because passkeys are off or the base URL
will not yield a host, nothing can sign anyone in: adoption is set to zero
and every credential counts as unusable. Set rather than skipped, since a
skipped gauge freezes at its last healthy value and reads as though passkeys
were still working.

Three tests: the four passkey login outcomes are present from the first
scrape (passkey_rp_mismatch in particular is only useful to alert on if the
series exists to compare against), the gauges populate with both usable
buckets present, and an account with one current and one moved credential
lands one in each bucket, agrees with the API's usable field, and counts
once as an adopter.

Also brings the logins_total outcome list in METRICS.md back in line with
the code. It had drifted, missing the account-standing refusals as well as
the four passkey outcomes.
@SiteRelEnby
SiteRelEnby merged commit 2dd2b7c into main Nov 24, 2026
24 checks passed
@SiteRelEnby
SiteRelEnby deleted the feat/passkey-adoption-gauges branch November 24, 2026 00:07
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.

1 participant