lib/opentelemetry/instrumentation/active_job/instrumentation.rb in opentelemetry-instrumentation-active_job-0.7.4 vs lib/opentelemetry/instrumentation/active_job/instrumentation.rb in opentelemetry-instrumentation-active_job-0.7.5
- old
+ new
@@ -61,17 +61,20 @@
def gem_version
::ActiveJob.version
end
def require_dependencies
+ require 'active_support/lazy_load_hooks'
require_relative 'patches/base'
require_relative 'handlers'
end
def patch_activejob
- ::ActiveJob::Base.prepend(Patches::Base) unless ::ActiveJob::Base <= Patches::Base
-
Handlers.subscribe
+
+ ActiveSupport.on_load(:active_job) do
+ ::ActiveJob::Base.prepend(Patches::Base) unless ::ActiveJob::Base <= Patches::Base
+ end
end
end
end
end
end