Skip to content

Commit

Permalink
Add exemplars for native histograms
Browse files Browse the repository at this point in the history
  • Loading branch information
shivanthzen committed Nov 17, 2024
1 parent 291b0b0 commit 8b1189b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions prometheus/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ func (m *withExemplarsMetric) Write(pb *dto.Metric) error {
case pb.Counter != nil:
pb.Counter.Exemplar = m.exemplars[len(m.exemplars)-1]
case pb.Histogram != nil:
if *pb.Histogram.Schema > math.MinInt32 {
exemplars := m.exemplars

Check failure on line 190 in prometheus/metric.go

View workflow job for this annotation

GitHub Actions / lint

declared and not used: exemplars) (typecheck)

Check failure on line 190 in prometheus/metric.go

View workflow job for this annotation

GitHub Actions / lint

declared and not used: exemplars) (typecheck)

Check failure on line 190 in prometheus/metric.go

View workflow job for this annotation

GitHub Actions / lint

declared and not used: exemplars) (typecheck)

Check failure on line 190 in prometheus/metric.go

View workflow job for this annotation

GitHub Actions / lint

declared and not used: exemplars) (typecheck)

Check failure on line 190 in prometheus/metric.go

View workflow job for this annotation

GitHub Actions / lint

declared and not used: exemplars) (typecheck)
pb.Histogram.Exemplars = append(pb.Histogram.Exemplars, m.exemplars...)
}
for _, e := range m.exemplars {
// pb.Histogram.Bucket are sorted by UpperBound.
i := sort.Search(len(pb.Histogram.Bucket), func(i int) bool {
Expand Down

0 comments on commit 8b1189b

Please sign in to comment.