+71
−31
File changed.
Preview size limit exceeded, changes collapsed.
Loading
calls_total conflates per-rule decisions with per-check outcomes:
summing it counts rule evaluations rather than requests, the
rule=unmatched placeholder is ambiguous, and failed-open checks are
only visible in errors_total, which shares no denominator.
Add two counters:
- checks_total{rate_limiter, action, matched, error}: exactly one
increment per check call, including fail-open. error=true also
covers count_distinct missing-key skips (Result#degraded?), so
checks_total{error=true} / checks_total is the error fraction.
- rule_evaluations_total{rate_limiter, rule, action, result}: one
increment per evaluated rule; action is configured, result decided
(an exceeded :log rule reports result=log).
The per-check counter is a new name rather than a reshaped calls_total:
prometheus-client-mmap allows one label signature per metric name, so
the shapes cannot coexist. calls_total and errors_total keep emitting
unchanged (deprecated) until consumers migrate; removal is a follow-up
major release. Check-path metric emission is now best-effort so a
metrics failure cannot alter a verdict or break fail-open.
Part of
gitlab-com/gl-infra/production-engineering#29519
File changed.
Preview size limit exceeded, changes collapsed.