Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/consumer/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ func (c *KafkaConsumer) pollLoop() {
"offset": record.Offset,
})
}
c.handleOutcome(outcome, err, record)

c.metricEmitter.Notify(metrics.Event{
Name: metrics.PublisherOutcomes,
Expand All @@ -280,6 +279,8 @@ func (c *KafkaConsumer) pollLoop() {
metrics.OutcomeLabel, outcome.String(),
},
})

c.handleOutcome(outcome, err, record)
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/consumer/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (h *WRPMessageHandler) HandleMessage(ctx context.Context, record *kgo.Recor
}

h.emitLog(log.LevelDebug, "successfully routed WRP message", map[string]any{
"outcome": outcome,
"outcome": outcome.String(),
})

return getOutcome(outcome), nil
Expand Down
9 changes: 8 additions & 1 deletion internal/publisher/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func (p *KafkaPublisher) Produce(ctx context.Context, msg *wrp.Message) (wrpkafk
metrics.ErrorTypeLabel, "not_started",
},
})
return 0, ErrPublisherNotStarted // Return 0 (which corresponds to wrpkafka.Accepted) as default
return 0, ErrPublisherNotStarted // Return 0 (which corresponds to wrpkafka.Attempted) as default
}

outcome, err := p.wrpPublisher.Produce(ctx, msg)
Expand All @@ -213,6 +213,13 @@ func (p *KafkaPublisher) Produce(ctx context.Context, msg *wrp.Message) (wrpkafk
"source": msg.Source,
"destination": msg.Destination,
}))
p.metricEmitter.Notify(metrics.Event{
Name: metrics.PublisherErrorsCounter,
Value: 1,
Labels: []string{
metrics.ErrorTypeLabel, "failed_to_produce_message",
},
})
return outcome, fmt.Errorf("failed to produce message: %w", err)
}

Expand Down
Loading