@@ -17,7 +17,7 @@ import (
17
17
18
18
type buckets [N int64 | float64 ] struct {
19
19
attrs attribute.Set
20
- res exemplar.Reservoir [ N ]
20
+ res exemplar.Reservoir
21
21
22
22
counts []uint64
23
23
count uint64
@@ -48,13 +48,13 @@ type histValues[N int64 | float64] struct {
48
48
noSum bool
49
49
bounds []float64
50
50
51
- newRes func () exemplar.Reservoir [ N ]
51
+ newRes func () exemplar.Reservoir
52
52
limit limiter [* buckets [N ]]
53
53
values map [attribute.Distinct ]* buckets [N ]
54
54
valuesMu sync.Mutex
55
55
}
56
56
57
- func newHistValues [N int64 | float64 ](bounds []float64 , noSum bool , limit int , r func () exemplar.Reservoir [ N ] ) * histValues [N ] {
57
+ func newHistValues [N int64 | float64 ](bounds []float64 , noSum bool , limit int , r func () exemplar.Reservoir ) * histValues [N ] {
58
58
// The responsibility of keeping all buckets correctly associated with the
59
59
// passed boundaries is ultimately this type's responsibility. Make a copy
60
60
// here so we can always guarantee this. Or, in the case of failure, have
@@ -106,12 +106,12 @@ func (s *histValues[N]) measure(ctx context.Context, value N, fltrAttr attribute
106
106
if ! s .noSum {
107
107
b .sum (value )
108
108
}
109
- b .res .Offer (ctx , t , value , droppedAttr )
109
+ b .res .Offer (ctx , t , exemplar . NewValue ( value ) , droppedAttr )
110
110
}
111
111
112
112
// newHistogram returns an Aggregator that summarizes a set of measurements as
113
113
// an histogram.
114
- func newHistogram [N int64 | float64 ](boundaries []float64 , noMinMax , noSum bool , limit int , r func () exemplar.Reservoir [ N ] ) * histogram [N ] {
114
+ func newHistogram [N int64 | float64 ](boundaries []float64 , noMinMax , noSum bool , limit int , r func () exemplar.Reservoir ) * histogram [N ] {
115
115
return & histogram [N ]{
116
116
histValues : newHistValues [N ](boundaries , noSum , limit , r ),
117
117
noMinMax : noMinMax ,
@@ -163,7 +163,7 @@ func (s *histogram[N]) delta(dest *metricdata.Aggregation) int {
163
163
hDPts [i ].Max = metricdata .NewExtrema (val .max )
164
164
}
165
165
166
- val . res . Collect (& hDPts [i ].Exemplars )
166
+ collectExemplars (& hDPts [i ].Exemplars , val . res . Collect )
167
167
168
168
i ++
169
169
}
@@ -219,7 +219,7 @@ func (s *histogram[N]) cumulative(dest *metricdata.Aggregation) int {
219
219
hDPts [i ].Max = metricdata .NewExtrema (val .max )
220
220
}
221
221
222
- val . res . Collect (& hDPts [i ].Exemplars )
222
+ collectExemplars (& hDPts [i ].Exemplars , val . res . Collect )
223
223
224
224
i ++
225
225
// TODO (#3006): This will use an unbounded amount of memory if there
0 commit comments