@@ -69,11 +69,11 @@ def initialize
6969 #
7070 # @param event [Karafka::Core::Monitoring::Event]
7171 def on_statistics_emitted ( event )
72- if Honeybadger . config . load_plugin_insights_events ?( :karafka )
72+ if Honeybadger . config . load_plugin_insights ?( :karafka , feature : :events )
7373 Honeybadger . event ( "statistics_emitted.karafka" , event . payload )
7474 end
7575
76- return unless Honeybadger . config . load_plugin_insights_metrics ?( :karafka )
76+ return unless Honeybadger . config . load_plugin_insights ?( :karafka , feature : :metrics )
7777
7878 statistics = event [ :statistics ]
7979 consumer_group_id = event [ :consumer_group_id ]
@@ -126,11 +126,11 @@ def on_error_occurred(event)
126126 extra_tags . merge! ( consumer_tags ( event . payload [ :caller ] ) )
127127 end
128128
129- if Honeybadger . config . load_plugin_insights_events ?( :karafka )
129+ if Honeybadger . config . load_plugin_insights ?( :karafka , feature : :events )
130130 Honeybadger . event ( "error.occurred.karafka" , error : event [ :error ] , **extra_tags )
131131 end
132132
133- if Honeybadger . config . load_plugin_insights_metrics ?( :karafka )
133+ if Honeybadger . config . load_plugin_insights ?( :karafka , feature : :metrics )
134134 increment_counter ( "error_occurred" , value : 1 , **extra_tags )
135135 end
136136 end
@@ -144,7 +144,7 @@ def on_connection_listener_fetch_loop_received(event)
144144 consumer_group_id = event [ :subscription_group ] . consumer_group . id
145145 extra_tags = { consumer_group : consumer_group_id }
146146
147- if Honeybadger . config . load_plugin_insights_metrics ?( :karafka )
147+ if Honeybadger . config . load_plugin_insights ?( :karafka , feature : :metrics )
148148 histogram ( "listener_polling_time_taken" , value : time_taken , **extra_tags )
149149 histogram ( "listener_polling_messages" , value : messages_count , **extra_tags )
150150 end
@@ -160,7 +160,7 @@ def on_consumer_consumed(event)
160160
161161 tags = consumer_tags ( consumer )
162162
163- if Honeybadger . config . load_plugin_insights_events ?( :karafka )
163+ if Honeybadger . config . load_plugin_insights ?( :karafka , feature : :events )
164164 event_context = tags . merge ( {
165165 consumer : consumer . class . name ,
166166 duration : event [ :time ] ,
@@ -171,7 +171,7 @@ def on_consumer_consumed(event)
171171 Honeybadger . event ( "consumer.consumed.karafka" , event_context )
172172 end
173173
174- if Honeybadger . config . load_plugin_insights_metrics ?( :karafka )
174+ if Honeybadger . config . load_plugin_insights ?( :karafka , feature : :metrics )
175175 increment_counter ( "consumer_messages" , value : messages . count , **tags )
176176 increment_counter ( "consumer_batches" , value : 1 , **tags )
177177 gauge ( "consumer_offset" , value : metadata . last_offset , **tags )
@@ -192,7 +192,7 @@ def on_consumer_consumed(event)
192192 #
193193 # @param event [Karafka::Core::Monitoring::Event]
194194 def on_consumer_#{ after } (event)
195- if Honeybadger.config.load_plugin_insights_metrics ?(:karafka)
195+ if Honeybadger.config.load_plugin_insights ?(:karafka, feature: :metrics )
196196 tags = consumer_tags(event.payload[:caller])
197197 increment_counter('consumer_#{ name } ', value: 1, **tags)
198198 end
@@ -205,7 +205,7 @@ def on_consumer_#{after}(event)
205205 def on_worker_process ( event )
206206 jq_stats = event [ :jobs_queue ] . statistics
207207
208- if Honeybadger . config . load_plugin_insights_metrics ?( :karafka )
208+ if Honeybadger . config . load_plugin_insights ?( :karafka , feature : :metrics )
209209 gauge ( "worker_total_threads" , value : ::Karafka ::App . config . concurrency )
210210 histogram ( "worker_processing" , value : jq_stats [ :busy ] )
211211 histogram ( "worker_enqueued_jobs" , value : jq_stats [ :enqueued ] )
@@ -218,7 +218,7 @@ def on_worker_process(event)
218218 def on_worker_processed ( event )
219219 jq_stats = event [ :jobs_queue ] . statistics
220220
221- if Honeybadger . config . load_plugin_insights_metrics ?( :karafka )
221+ if Honeybadger . config . load_plugin_insights ?( :karafka , feature : :metrics )
222222 histogram ( "worker_processing" , value : jq_stats [ :busy ] )
223223 end
224224 end
0 commit comments