Skip to content

Commit

Permalink
Eagerly initialize failed metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
weeco committed Nov 4, 2021
1 parent ffa4211 commit 5fdb775
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion e2e/producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ func (s *Service) produceMessage(ctx context.Context, partition int) {
ackDuration := time.Since(startTime)
s.messagesProducedInFlight.WithLabelValues(pID).Dec()
s.messagesProducedTotal.WithLabelValues(pID).Inc()
// We add 0 in order to ensure that the "failed" metric series for that partition id is initialized as well.
// We add 0 in order to ensure that the "failed" metric series for that partition id are initialized as well.
s.messagesProducedFailed.WithLabelValues(pID).Add(0)
s.lostMessages.WithLabelValues(pID).Add(0)

if err != nil {
s.messagesProducedFailed.WithLabelValues(pID).Inc()
Expand Down

0 comments on commit 5fdb775

Please sign in to comment.