lib/ddtrace/contrib/active_support/notifications/subscription.rb in ddtrace-0.28.0 vs lib/ddtrace/contrib/active_support/notifications/subscription.rb in ddtrace-0.29.0
- old
+ new
@@ -3,20 +3,23 @@
module ActiveSupport
module Notifications
# An ActiveSupport::Notification subscription that wraps events with tracing.
class Subscription
attr_accessor \
- :tracer,
:span_name,
:options
def initialize(tracer, span_name, options, &block)
raise ArgumentError, 'Must be given a block!' unless block_given?
@tracer = tracer
@span_name = span_name
@options = options
@handler = Handler.new(&block)
@callbacks = Callbacks.new
+ end
+
+ def tracer
+ @tracer.is_a?(Proc) ? @tracer.call : @tracer
end
# ActiveSupport 3.x calls this
def call(name, start, finish, id, payload)
start_span(name, id, payload, start)