You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm new to working with Prometheus so apologies if this is a misunderstanding on my part.
I noticed when writing a test for a Counter without any ConstLabels defined in the CounterOpts struct, the test will fail and provide an error message saying two identical strings do not match.
This can be replicated by modifying slightly one of the tests in the testutil_test.go file, by just removing the labels, example:
funcTestCollectAndCompareBug(t*testing.T) {
constmetadata=` # HELP some_total A value that represents a counter. # TYPE some_total counter `c:=prometheus.NewCounter(prometheus.CounterOpts{
Name: "some_total",
Help: "A value that represents a counter.",
})
c.Inc()
expected:=` some_total 1 `iferr:=CollectAndCompare(c, strings.NewReader(metadata+expected), "some_total"); err!=nil {
t.Errorf("unexpected collecting result:\n%s", err)
}
}
This results in the following output:
--- FAIL: TestCollectAndCompareBug (0.00s)
testutil_test.go:165: unexpected collecting result:
metric output does not match expectation; want:
# HELP some_total A value that represents a counter.# TYPE some_total counter
some_total 1
got:
# HELP some_total A value that represents a counter.# TYPE some_total counter
some_total 1
FAIL
Process finished with exit code 1
I haven't dug in too deeply but if this is a bug and anyone have some pointers to fix I can take it on as soon as I have some free cycles.
The text was updated successfully, but these errors were encountered:
I'm new to working with Prometheus so apologies if this is a misunderstanding on my part.
I noticed when writing a test for a Counter without any ConstLabels defined in the CounterOpts struct, the test will fail and provide an error message saying two identical strings do not match.
This can be replicated by modifying slightly one of the tests in the
testutil_test.go
file, by just removing the labels, example:This results in the following output:
I haven't dug in too deeply but if this is a bug and anyone have some pointers to fix I can take it on as soon as I have some free cycles.
The text was updated successfully, but these errors were encountered: