Skip to content

Commit

Permalink
feat: add karafka processing_lag to event (#613)
Browse files Browse the repository at this point in the history
  • Loading branch information
roelbondoc authored Sep 19, 2024
1 parent 131662c commit a527eea
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/honeybadger/plugins/karafka.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ module Plugins
requirement { defined?(::Karafka) && ::Karafka.respond_to?(:monitor) }

execution do
::Karafka.monitor.subscribe('error.occurred') do |event|
::Karafka.monitor.subscribe("error.occurred") do |event|
Honeybadger.notify(event[:error])
Honeybadger.event('error.occurred', error: event[:error]) if config.load_plugin_insights?(:karafka)
Honeybadger.event("error.occurred.karafka", error: event[:error]) if config.load_plugin_insights?(:karafka)
end

if config.load_plugin_insights?(:karafka)
Expand All @@ -19,10 +19,11 @@ module Plugins
id: event.payload[:caller].id,
topic: event.payload[:caller].messages.metadata.topic,
messages_count: event.payload[:caller].messages.metadata.size,
processing_lag: event.payload[:caller].messages.metadata.processing_lag,
partition: event.payload[:caller].messages.metadata.partition
}

Honeybadger.event('consumer.consumed.karafka', context)
Honeybadger.event("consumer.consumed.karafka", context)
end
end
end
Expand Down

0 comments on commit a527eea

Please sign in to comment.