diff --git a/instrumentation/active_job/lib/opentelemetry/instrumentation/active_job/handlers.rb b/instrumentation/active_job/lib/opentelemetry/instrumentation/active_job/handlers.rb index 9c14f65e1..c1061ed71 100644 --- a/instrumentation/active_job/lib/opentelemetry/instrumentation/active_job/handlers.rb +++ b/instrumentation/active_job/lib/opentelemetry/instrumentation/active_job/handlers.rb @@ -57,7 +57,7 @@ def subscribe } @subscriptions = handlers_by_pattern.map do |key, handler| - ActiveSupport::Notifications.subscribe("#{key}.active_job", handler) + ::ActiveSupport::Notifications.subscribe("#{key}.active_job", handler) end end diff --git a/instrumentation/active_job/lib/opentelemetry/instrumentation/active_job/instrumentation.rb b/instrumentation/active_job/lib/opentelemetry/instrumentation/active_job/instrumentation.rb index 260f5fc45..c76427f6d 100644 --- a/instrumentation/active_job/lib/opentelemetry/instrumentation/active_job/instrumentation.rb +++ b/instrumentation/active_job/lib/opentelemetry/instrumentation/active_job/instrumentation.rb @@ -17,7 +17,7 @@ class Instrumentation < OpenTelemetry::Instrumentation::Base end present do - defined?(::ActiveJob) + defined?(::ActiveJob) && defined?(::ActiveSupport) end compatible do