Skip to content
New issue

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

Prometheus starting outputting floats? #820

Merged
merged 1 commit into from
Jan 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions metrics/prometheus/prometheus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,14 @@ func TestHistogram(t *testing.T) {

// Then, we use ExpectedObservationsLessThan to validate.
for _, line := range strings.Split(scrape(), "\n") {
t.Logf("### %s", line)
match := re.FindStringSubmatch(line)
if match == nil {
continue
}

bucket, _ := strconv.ParseInt(match[1], 10, 64)
have, _ := strconv.ParseInt(match[2], 10, 64)
have, _ := strconv.ParseFloat(match[2], 64)

want := teststat.ExpectedObservationsLessThan(bucket)
if match[1] == "+Inf" {
Expand All @@ -182,7 +183,7 @@ func TestHistogram(t *testing.T) {
// with my Expected calculation, or in Prometheus.
tolerance := 0.25
if delta := math.Abs(float64(want) - float64(have)); (delta / float64(want)) > tolerance {
t.Errorf("Bucket %d: want %d, have %d (%.1f%%)", bucket, want, have, (100.0 * delta / float64(want)))
t.Errorf("Bucket %d: want %d, have %d (%.1f%%)", bucket, want, int(have), (100.0 * delta / float64(want)))
}
}
}
Expand Down