This commit is contained in:
Shivanth MP 2024-11-22 09:40:13 +01:00 committed by GitHub
commit a1ce2cece1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -186,6 +186,9 @@ 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 {
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 {