Skip to content

Commit

Permalink
Fix missing value of "lagObserved"
Browse files Browse the repository at this point in the history
Metric only being set if there are values, which leads to an artifacts
of the metrics. Set it when there are no metrics as well.
  • Loading branch information
lwolf committed Nov 17, 2022
1 parent 5370864 commit 2f44d34
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pkg/providers/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func (l *PrometheusMP) GetLagByPartition(partition int32) time.Duration {
behind := l.GetMessagesBehind(partition)
production := l.GetProductionRate(partition)
if production == 0 {
lagObserved.WithLabelValues(l.consumer, strconv.Itoa(int(partition))).Set(0)
return 0
}
lagM := float64(behind) / float64(production)
Expand Down

0 comments on commit 2f44d34

Please sign in to comment.