Skip to content

fix(prom): increment request_fail_count on errored results - #765

Open
vulragrag-star wants to merge 1 commit into
tsenart:masterfrom
vulragrag-star:fix/750-prom-fail-counter-inc
Open

vulragrag-star wants to merge 1 commit into
tsenart:masterfrom
vulragrag-star:fix/750-prom-fail-counter-inc

Conversation

@vulragrag-star

Copy link
Copy Markdown

Background

Fixes #750

Metrics.Observe called WithLabelValues on request_fail_count when res.Error was set, but never .Inc(). That registers the label set (so the metric appears in scrapes) while leaving the counter at zero for every failed request.

Checklist

  • Git commit messages conform to community standards.
  • Each Git commit represents meaningful milestones or atomic units of work.
  • Changed or added code is covered by appropriate tests.

Testing

  • go test ./lib/prom/ -count=1 passes
  • TestMetrics_Observe_FailCounterIncremented fails on master (got 0, want 2) and passes with this change

WithLabelValues alone registers the label set but never bumps the
counter, so request_fail_count stayed at zero for every failed
request. Call Inc after selecting the labels.
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.

Prometheus request_fail_count counter never incremented

1 participant