We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It looks like v0.13.0 introduced a bug in promhttp.InstrumentRoundTripperCounter (from #1055, it appears).
promhttp.InstrumentRoundTripperCounter
Instead of replacing the Inc() call with a wrapped call to exemplarAdd(...), the Inc() call was left in:
Inc()
exemplarAdd(...)
https://github.com/prometheus/client_golang/pull/1055/files#diff-7871a83741d29b5f29e3c47d1c284f948c258a0c6fc18895f0c2d4204cc46054R76-R81
The impact is that counter metrics are now double-counted when instrumented with promhttp.InstrumentRoundTripperCounter.
The bug can be observed with this test:
func TestBug(t *testing.T) { counter := prometheus.NewCounterVec( prometheus.CounterOpts{Name: "requests_total", Help: "A request counter"}, []string{"method", "code"}, ) reg := prometheus.NewRegistry() reg.MustRegister(counter) rt := promhttp.InstrumentRoundTripperCounter(counter, http.DefaultTransport) c := &http.Client{Transport: rt} srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) })) req, _ := http.NewRequestWithContext(context.Background(), http.MethodGet, srv.URL, nil) resp, _ := c.Do(req) defer resp.Body.Close() expected := ` # HELP requests_total A request counter # TYPE requests_total counter requests_total{code="200",method="get"} 1 ` if err := testutil.GatherAndCompare(reg, strings.NewReader(expected), "requests_total", ); err != nil { t.Fatal(err) } }
The output is:
[...] Diff: --- metric output does not match expectation; want +++ got: @@ -2,3 +2,3 @@ # TYPE requests_total counter -requests_total{code="200",method="get"} 1 +requests_total{code="200",method="get"} 2
I'll try to issue a fix for this today!
The text was updated successfully, but these errors were encountered:
#1118 will fix this
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
It looks like v0.13.0 introduced a bug in
promhttp.InstrumentRoundTripperCounter
(from #1055, it appears).Instead of replacing the
Inc()
call with a wrapped call toexemplarAdd(...)
, theInc()
call was left in:https://github.com/prometheus/client_golang/pull/1055/files#diff-7871a83741d29b5f29e3c47d1c284f948c258a0c6fc18895f0c2d4204cc46054R76-R81
The impact is that counter metrics are now double-counted when instrumented with
promhttp.InstrumentRoundTripperCounter
.The bug can be observed with this test:
The output is:
I'll try to issue a fix for this today!
The text was updated successfully, but these errors were encountered: