Repository navigation
feat(metrics): count provider calls and record latency by endpoint and outcome - #342
Conversation
…d outcome Counts payment provider calls in linqCall by endpoint path and outcome so no rail can forget to record them. Distinguishes success, 4xx, 5xx, 429, and timeout outcomes. Preserves bounded cardinality by normalizing endpoint paths and stripping query parameters. Observes latency across all failure outcomes as well as successes.
|
Merged into The outcome classification is the valuable part. The existing
Those are four different pages at 3am and they were previously indistinguishable. Worth having. Stripping the query string before labelling is also the right instinct, and more important than it looks: One change on merge. So it now collapses identifier-shaped segments to /^\d+$/ | /^[0-9a-f-]{16,}$/i | segment.length > 24 → ":id"No existing series changes — I added a test asserting each of the current static paths is returned untouched, plus cases for a numeric id, a hex id and a long reference being collapsed, and one confirming the query is still stripped. Worth knowing for next time: a Prometheus histogram already exposes tsc clean, 1,341 tests pass. |
Context
Every naira operation across the rails (offramp, onramp, and bills) passes through
src/linq/http.tsas the single transport to Linq. Previously, provider call success/failure counts were not tracked, and provider outages were invisible until user-reported.Changes
provider_calls_total: Added Prometheus counter labeled by boundedendpointandoutcome(success,4xx,5xx,429,timeout).provider_calls_totaldirectly insidelinqCall'sfinallyblock so no rail can omit it./b2b/status?id=...->/b2b/status) ensuring clean, low-cardinality label sets.src/__tests__/linq/providerCalls.test.tsasserting counter increments across all outcome categories against the fake provider.Closes #269