feat: expose retained account quota metrics - #359
Open
korkin25 wants to merge 1 commit into
Open
Conversation
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.
Operators can inspect retained quota evidence in the admin dialog, but
/metricscurrently has no account inventory, membership or quota gauges. This adds 36 native gauge families for every non-deleted enrolled identity, including inactive, never-successful and unassigned accounts, plus each retained source's reported usage, reset time, freshness and routing-selection provenance.Collection runs after the existing metrics authorization check. It reads only the required metadata in three set-based queries inside one
REPEATABLE READ, READ ONLYtransaction, bounded by a five-second total read deadline including connection-pool checkout. Timeout or caller termination cancels the owned collector and queued/active SQL. Collection failures preserve operational metrics and expose collector failure without cached or fabricated account data. Scrapes do not load account secrets, refresh OAuth, poll providers, enqueue work, call models or switch accounts.Unknown measurements remain unknown, elapsed/stale evidence remains visible, and reported remaining percentages do not establish actual provider capacity. Labels use internal UUIDs, fixed enums and opaque hashes, with per-account cardinality limits and no email, raw provider identifiers or error payloads. The current admin dialog, selected percentage/countdown, routing behavior and default routing telemetry remain unchanged; only metrics evaluation suppresses routing-decision telemetry.
The shared group digest exactly matches the current upstream evidence dialog. This 36-family contract omits the earlier experimental fork's automatic source/reset conflict gauges. Its meter digest differs from that fork's prefixed digest, so the monitoring documentation describes explicit dashboard/history migration rather than treating those time series as a drop-in replacement. There are no schema, dependency, CI, runtime-version or release-packaging changes.
Validation on Elixir 1.20.4 / OTP 29 and synthetic PostgreSQL 18:
make test-fast N=4: 8,449 passed, 59 standardunix_integrationexclusions; all four partitions passed.