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

Exemplar for +Inf bucket adds bucket with wrong value #1147

Closed
balintzs opened this issue Oct 12, 2022 · 5 comments
Closed

Exemplar for +Inf bucket adds bucket with wrong value #1147

balintzs opened this issue Oct 12, 2022 · 5 comments

Comments

@balintzs
Copy link
Contributor

When writing histogram metrics, and there is an exemplar for the +Inf bucket, then the +Inf bucket is added with the value of the previous bucket:
https://github.com/prometheus/client_golang/blob/main/prometheus/metric.go#L188

This is incorrect, as the cumulative count of the +Inf bucket should instead be added with the total count of the histogram datapoint.

The above behaviour results in invalid values being reported for the +Inf bucket.

@balintzs
Copy link
Contributor Author

I'll open a PR shortly

@bwplotka
Copy link
Member

Thanks! Approved fix with some small nit.

@balintzs
Copy link
Contributor Author

Thanks for merging it, @bwplotka. When can we expect it to get released?

@bwplotka
Copy link
Member

Can you just use commit sha for now? We will release soon, but don't know when (KubeCom + PromCon is coming)

@bboreham
Copy link
Member

bboreham commented Nov 1, 2022

Note your link to the problem now shows the fixed code, because it references main.
You can get a fixed link by pressing 'Y' in the GitHub UI, e.g.:

// The +Inf bucket should be explicitly added if there is an exemplar for it, similar to non-const histogram logic in https://github.com/prometheus/client_golang/blob/main/prometheus/histogram.go#L357-L365.
b := &dto.Bucket{
CumulativeCount: proto.Uint64(pb.Histogram.Bucket[len(pb.Histogram.GetBucket())-1].GetCumulativeCount()),

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

No branches or pull requests

3 participants