This repository was archived by the owner on Aug 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 10 files changed +172
-41
lines changed
Expand file tree Collapse file tree 10 files changed +172
-41
lines changed Original file line number Diff line number Diff line change 1212
1313[[constraint ]]
1414 name = " github.com/prometheus/client_golang"
15- version = " 1.1.0 "
15+ version = " 1.4.1 "
1616
1717[[constraint ]]
1818 name = " github.com/stretchr/testify"
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package metrics
1818type Counter interface {
1919 // Inc adds the given value to the counter.
2020 Inc (int64 )
21+ IncWithExemplar (int64 , string )
2122}
2223
2324// NullCounter counter that does nothing
@@ -26,3 +27,5 @@ var NullCounter Counter = nullCounter{}
2627type nullCounter struct {}
2728
2829func (nullCounter ) Inc (int64 ) {}
30+
31+ func (n nullCounter ) IncWithExemplar (int64 , string ) {}
Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ func (c *Counter) Inc(delta int64) {
3535 c .counter .Add (float64 (delta ))
3636}
3737
38+ // IncWithExemplar adds the given value alongwith the trace ID provided.
39+ func (c * Counter ) IncWithExemplar (int64 , string ) {
40+ panic ("not implemented" )
41+ }
42+
3843// Gauge is an adapter from go-kit Gauge to jaeger-lib Gauge
3944type Gauge struct {
4045 gauge kit.Gauge
@@ -65,6 +70,11 @@ func (t *Timer) Record(delta time.Duration) {
6570 t .hist .Observe (delta .Seconds ())
6671}
6772
73+ // RecordWithExemplar saves the time passed in with the trace ID provided.
74+ func (t * Timer ) RecordWithExemplar (time.Duration , string ) {
75+ panic ("not implemented" )
76+ }
77+
6878// Histogram is an adapter from go-kit Histogram to jaeger-lib Histogram
6979type Histogram struct {
7080 hist kit.Histogram
@@ -79,3 +89,8 @@ func NewHistogram(hist kit.Histogram) *Histogram {
7989func (t * Histogram ) Record (value float64 ) {
8090 t .hist .Observe (value )
8191}
92+
93+ // RecordWithExemplar saves the time passed in with the trace ID provided.
94+ func (t * Histogram ) RecordWithExemplar (float64 , string ) {
95+ panic ("not implemented" )
96+ }
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package metrics
1818type Histogram interface {
1919 // Records the value passed in.
2020 Record (float64 )
21+ RecordWithExemplar (float64 , string )
2122}
2223
2324// NullHistogram that does nothing
@@ -26,3 +27,5 @@ var NullHistogram Histogram = nullHistogram{}
2627type nullHistogram struct {}
2728
2829func (nullHistogram ) Record (float64 ) {}
30+
31+ func (n nullHistogram ) RecordWithExemplar (float64 , string ) {}
Original file line number Diff line number Diff line change @@ -276,6 +276,10 @@ func (l *localTimer) Record(d time.Duration) {
276276 l .localBackend .RecordTimer (l .name , l .tags , d )
277277}
278278
279+ func (l * localTimer ) RecordWithExemplar (d time.Duration , t string ) {
280+ l .localBackend .RecordTimer (l .name , l .tags , d )
281+ }
282+
279283type localHistogram struct {
280284 stats
281285}
@@ -284,6 +288,10 @@ func (l *localHistogram) Record(v float64) {
284288 l .localBackend .RecordHistogram (l .name , l .tags , v )
285289}
286290
291+ func (l * localHistogram ) RecordWithExemplar (v float64 , t string ) {
292+ l .localBackend .RecordHistogram (l .name , l .tags , v )
293+ }
294+
287295type localCounter struct {
288296 stats
289297}
@@ -292,6 +300,10 @@ func (l *localCounter) Inc(delta int64) {
292300 l .localBackend .IncCounter (l .name , l .tags , delta )
293301}
294302
303+ func (l * localCounter ) IncWithExemplar (delta int64 , t string ) {
304+ l .localBackend .IncCounter (l .name , l .tags , delta )
305+ }
306+
295307type localGauge struct {
296308 stats
297309}
Original file line number Diff line number Diff line change @@ -42,6 +42,12 @@ func (c *counter) Inc(delta int64) {
4242 }
4343}
4444
45+ func (c * counter ) IncWithExemplar (delta int64 , t string ) {
46+ for _ , counter := range c .counters {
47+ counter .Inc (delta )
48+ }
49+ }
50+
4551// Counter implements metrics.Factory interface
4652func (f * Factory ) Counter (options metrics.Options ) metrics.Counter {
4753 counter := & counter {
@@ -63,6 +69,12 @@ func (t *timer) Record(delta time.Duration) {
6369 }
6470}
6571
72+ func (t * timer ) RecordWithExemplar (delta time.Duration , traceID string ) {
73+ for _ , timer := range t .timers {
74+ timer .Record (delta )
75+ }
76+ }
77+
6678// Timer implements metrics.Factory interface
6779func (f * Factory ) Timer (options metrics.TimerOptions ) metrics.Timer {
6880 timer := & timer {
@@ -84,6 +96,12 @@ func (h *histogram) Record(value float64) {
8496 }
8597}
8698
99+ func (h * histogram ) RecordWithExemplar (value float64 , t string ) {
100+ for _ , histogram := range h .histograms {
101+ histogram .Record (value )
102+ }
103+ }
104+
87105// Histogram implements metrics.Factory interface
88106func (f * Factory ) Histogram (options metrics.HistogramOptions ) metrics.Histogram {
89107 histogram := & histogram {
You can’t perform that action at this time.
0 commit comments