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

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/tracing/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.



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

def initialize(block)
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



118
119
120
# File 'lib/datadog/tracing/contrib/active_support/notifications/subscription.rb', line 118

def block
  @block
end

Instance Method Details

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



124
125
126
127
128
129
130
# File 'lib/datadog/tracing/contrib/active_support/notifications/subscription.rb', line 124

def run(span, name, id, payload)
  @block.call(span, name, id, payload) if @block
rescue StandardError => e
  Datadog.logger.debug(
    "ActiveSupport::Notifications handler for '#{name}' failed: #{e.class.name} #{e.message}"
  )
end