lib/opentelemetry/instrumentation/active_job/instrumentation.rb in opentelemetry-instrumentation-active_job-0.6.1 vs lib/opentelemetry/instrumentation/active_job/instrumentation.rb in opentelemetry-instrumentation-active_job-0.7.0
- old
+ new
@@ -7,19 +7,19 @@
module OpenTelemetry
module Instrumentation
module ActiveJob
# The Instrumentation class contains logic to detect and install the ActiveJob instrumentation
class Instrumentation < OpenTelemetry::Instrumentation::Base
- MINIMUM_VERSION = Gem::Version.new('6.0.0')
+ MINIMUM_VERSION = Gem::Version.new('6.1.0')
install do |_config|
require_dependencies
patch_activejob
end
present do
- defined?(::ActiveJob)
+ defined?(::ActiveJob) && defined?(::ActiveSupport)
end
compatible do
gem_version >= MINIMUM_VERSION
end
@@ -62,15 +62,16 @@
::ActiveJob.version
end
def require_dependencies
require_relative 'patches/base'
- require_relative 'patches/active_job_callbacks'
+ require_relative 'handlers'
end
def patch_activejob
- ::ActiveJob::Base.prepend(Patches::Base)
- ::ActiveJob::Base.prepend(Patches::ActiveJobCallbacks)
+ ::ActiveJob::Base.prepend(Patches::Base) unless ::ActiveJob::Base.ancestors.include?(Patches::Base)
+
+ Handlers.subscribe
end
end
end
end
end