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

Add exemplar support for const histogram #986

Merged
merged 7 commits into from
Mar 17, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Misc fixes
Co-authored-by: Francis Bogsanyi <[email protected]>

Signed-off-by: William Perron <[email protected]>
  • Loading branch information
wperron committed Mar 11, 2022
commit 16ac1292c7437c2fbb62f48380e11f65578eb2c6
4 changes: 2 additions & 2 deletions prometheus/histogram.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ func (h *constHistogram) Write(out *dto.Metric) error {
his := &dto.Histogram{}
// h.buckets, buckets and bounds are all the same length
buckets := make([]*dto.Bucket, 0, len(h.buckets))
bounds := make([]float64, 0)
bounds := make([]float64, 0, len(h.buckets))

his.SampleCount = proto.Uint64(h.count)
his.SampleSum = proto.Float64(h.sum)
Expand All @@ -599,8 +599,8 @@ func (h *constHistogram) Write(out *dto.Metric) error {
// make sure that both bounds and buckets have the same ordering
if len(buckets) > 0 {
sort.Sort(buckSort(buckets))
sort.Float64s(bounds)
}
sort.Float64s(bounds)

if len(h.exemplars) > 0 {
r := len(buckets)
Expand Down