Class: Datadog::Contrib::ActiveSupport::Notifications::Subscription::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/ddtrace/contrib/active_support/notifications/subscription.rb

Overview

Wrapper for subscription handler

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Handler

Returns a new instance of Handler.



110
111
112
# File 'lib/ddtrace/contrib/active_support/notifications/subscription.rb', line 110

def initialize(&block)
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



108
109
110
# File 'lib/ddtrace/contrib/active_support/notifications/subscription.rb', line 108

def block
  @block
end

Instance Method Details

#run(span, name, id, payload) ⇒ Object



114
115
116
117
118
# File 'lib/ddtrace/contrib/active_support/notifications/subscription.rb', line 114

def run(span, name, id, payload)
  run!(span, name, id, payload)
rescue StandardError => e
  Datadog::Tracer.log.debug("ActiveSupport::Notifications handler for '#{name}' failed: #{e.message}")
end

#run!(*args) ⇒ Object



120
121
122
# File 'lib/ddtrace/contrib/active_support/notifications/subscription.rb', line 120

def run!(*args)
  @block.call(*args)
end