From a96ca6984f1a8520d657927358bc65b1b0190c87 Mon Sep 17 00:00:00 2001 From: Roel Bondoc Date: Wed, 14 Aug 2024 21:53:20 -0400 Subject: [PATCH] fix: init karafka plugin only if monitor is available If a ruby application is using only the `waterdrop` gem, the `Karafka` namespace is available, but the `monitor` method is not. The plugin will only work if the monitoring is available. --- lib/honeybadger/plugins/karafka.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/honeybadger/plugins/karafka.rb b/lib/honeybadger/plugins/karafka.rb index 88e4b8d6..fa66439c 100644 --- a/lib/honeybadger/plugins/karafka.rb +++ b/lib/honeybadger/plugins/karafka.rb @@ -3,7 +3,7 @@ module Honeybadger module Plugins Plugin.register :karafka do - requirement { defined?(::Karafka) } + requirement { defined?(::Karafka) && ::Karafka.respond_to?(:monitor) } execution do ::Karafka.monitor.subscribe('error.occurred') do |event|