Skip to content

Commit

Permalink
Add topic field to Undeliverable/Reject logs from Tracer.
Browse files Browse the repository at this point in the history
  • Loading branch information
lthibault committed Nov 9, 2022
1 parent 37825bf commit f694bba
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/pubsub/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ func (t Tracer) DeliverMessage(*pubsub.Message) {

// RejectMessage is invoked when a message is Rejected or Ignored.
// The reason argument can be one of the named strings Reject*.
func (t Tracer) RejectMessage(_ *pubsub.Message, reason string) {
func (t Tracer) RejectMessage(m *pubsub.Message, reason string) {
t.Log.
WithField("topic", m.GetTopic()).
WithField("reason", reason).
Info("message rejected")
t.Metrics.Incr("rejected")
Expand Down Expand Up @@ -119,8 +120,10 @@ func (t Tracer) DropRPC(r *pubsub.RPC, id peer.ID) {

// UndeliverableMessage is invoked when the consumer of Subscribe is not reading messages fast enough and
// the pressure release mechanism trigger, dropping messages.
func (t Tracer) UndeliverableMessage(_ *pubsub.Message) {
t.Log.Warn("message undeliverable")
func (t Tracer) UndeliverableMessage(m *pubsub.Message) {
t.Log.
WithField("topic", m.GetTopic()).
Warn("message undeliverable")
t.Metrics.Incr("undeliverable")
}

Expand Down

0 comments on commit f694bba

Please sign in to comment.