@@ -20,6 +20,7 @@ import (
20
20
"time"
21
21
22
22
dto "github.com/prometheus/client_model/go"
23
+ "github.com/prometheus/common/model"
23
24
"google.golang.org/protobuf/types/known/timestamppb"
24
25
)
25
26
@@ -44,19 +45,6 @@ type Counter interface {
44
45
Add (float64 )
45
46
}
46
47
47
- // ExemplarAdder is implemented by Counters that offer the option of adding a
48
- // value to the Counter together with an exemplar. Its AddWithExemplar method
49
- // works like the Add method of the Counter interface but also replaces the
50
- // currently saved exemplar (if any) with a new one, created from the provided
51
- // value, the current time as timestamp, and the provided labels. Empty Labels
52
- // will lead to a valid (label-less) exemplar. But if Labels is nil, the current
53
- // exemplar is left in place. AddWithExemplar panics if the value is < 0, if any
54
- // of the provided labels are invalid, or if the provided labels contain more
55
- // than 128 runes in total.
56
- type ExemplarAdder interface {
57
- AddWithExemplar (value float64 , exemplar Labels )
58
- }
59
-
60
48
// CounterOpts is an alias for Opts. See there for doc comments.
61
49
type CounterOpts Opts
62
50
@@ -143,11 +131,6 @@ func (c *counter) Add(v float64) {
143
131
}
144
132
}
145
133
146
- func (c * counter ) AddWithExemplar (v float64 , e Labels ) {
147
- c .Add (v )
148
- c .updateExemplar (v , e )
149
- }
150
-
151
134
func (c * counter ) Inc () {
152
135
atomic .AddUint64 (& c .valInt , 1 )
153
136
}
@@ -169,11 +152,11 @@ func (c *counter) Write(out *dto.Metric) error {
169
152
return populateMetric (CounterValue , val , c .labelPairs , exemplar , out , c .createdTs )
170
153
}
171
154
172
- func (c * counter ) updateExemplar (v float64 , l Labels ) {
155
+ func (c * counter ) updateExemplar (v float64 , l Labels , scheme model. ValidationScheme ) {
173
156
if l == nil {
174
157
return
175
158
}
176
- e , err := newExemplar (v , c .now (), l )
159
+ e , err := newExemplar (v , c .now (), l , scheme )
177
160
if err != nil {
178
161
panic (err )
179
162
}
0 commit comments