lib/opentelemetry/instrumentation/active_job/handlers.rb in opentelemetry-instrumentation-active_job-0.7.4 vs lib/opentelemetry/instrumentation/active_job/handlers.rb in opentelemetry-instrumentation-active_job-0.7.5
- old
+ new
@@ -12,10 +12,12 @@
module OpenTelemetry
module Instrumentation
module ActiveJob
# Module that contains custom event handlers, which are used to generate spans per event
module Handlers
+ EVENT_NAMESPACE = 'active_job'
+
module_function
# Subscribes Event Handlers to relevant ActiveJob notifications
#
# The following events are recorded as spans:
@@ -55,10 +57,10 @@
'retry_stopped' => default_handler,
'discard' => default_handler
}
@subscriptions = handlers_by_pattern.map do |key, handler|
- ::ActiveSupport::Notifications.subscribe("#{key}.active_job", handler)
+ ::ActiveSupport::Notifications.subscribe("#{key}.#{EVENT_NAMESPACE}", handler)
end
end
# Removes Event Handler Subscriptions for ActiveJob notifications
# @note this method is not thread-safe and should not be used in a multi-threaded context