@@ -3,7 +3,6 @@ package partition
3
3
import (
4
4
"context"
5
5
"fmt"
6
- "math"
7
6
"time"
8
7
9
8
"github.com/go-kit/log"
@@ -51,7 +50,7 @@ type ReaderMetrics struct {
51
50
fetchesErrors prometheus.Counter
52
51
fetchesTotal prometheus.Counter
53
52
fetchWaitDuration prometheus.Histogram
54
- receiveDelay * prometheus.HistogramVec
53
+ receiveDelay * prometheus.GaugeVec
55
54
kprom * kprom.Metrics
56
55
}
57
56
@@ -75,14 +74,9 @@ func NewReaderMetrics(r prometheus.Registerer) *ReaderMetrics {
75
74
Name : "loki_kafka_reader_fetches_total" ,
76
75
Help : "Total number of Kafka fetches performed." ,
77
76
}),
78
- receiveDelay : promauto .With (r ).NewHistogramVec (prometheus.HistogramOpts {
79
- Name : "loki_kafka_reader_receive_delay_seconds" ,
80
- Help : "Delay between producing a record and receiving it." ,
81
- NativeHistogramZeroThreshold : math .Pow (2 , - 10 ),
82
- NativeHistogramBucketFactor : 1.2 ,
83
- NativeHistogramMaxBucketNumber : 100 ,
84
- NativeHistogramMinResetDuration : 1 * time .Hour ,
85
- Buckets : prometheus .ExponentialBuckets (0.125 , 2 , 18 ),
77
+ receiveDelay : promauto .With (r ).NewGaugeVec (prometheus.GaugeOpts {
78
+ Name : "loki_kafka_reader_receive_delay_seconds" ,
79
+ Help : "Delay between producing a record and receiving it." ,
86
80
}, []string {"phase" }),
87
81
kprom : client .NewReaderClientMetrics ("partition-reader" , r ),
88
82
}
@@ -152,7 +146,7 @@ func (r *KafkaReader) Poll(ctx context.Context, maxPollRecords int) ([]Record, e
152
146
var numRecords int
153
147
fetches .EachRecord (func (record * kgo.Record ) {
154
148
numRecords ++
155
- r .metrics .receiveDelay .WithLabelValues (r .phase ).Observe (time .Since (record .Timestamp ).Seconds ())
149
+ r .metrics .receiveDelay .WithLabelValues (r .phase ).Set (time .Since (record .Timestamp ).Seconds ())
156
150
})
157
151
r .metrics .recordsPerFetch .Observe (float64 (numRecords ))
158
152
0 commit comments