Module: Datadog::Tracing::Contrib::ActiveSupport::Notifications::Event::ClassMethods
- Defined in:
- lib/datadog/tracing/contrib/active_support/notifications/event.rb
Overview
Redefines some class behaviors for a Subscriber to make it a bit simpler for an Event.
Instance Method Summary collapse
- #payload_exception(payload) ⇒ Object
- #report_if_exception(span, payload) ⇒ Object
- #span_options ⇒ Object
- #subscribe(pattern = nil, span_name = nil, options = nil) ⇒ Object
-
#subscribe! ⇒ Object
Publicly exposes protected method ‘subscribe!`.
- #subscription(span_name = nil, options = nil) ⇒ Object
- #supported? ⇒ Boolean
Instance Method Details
#payload_exception(payload) ⇒ Object
59 60 61 62 |
# File 'lib/datadog/tracing/contrib/active_support/notifications/event.rb', line 59 def payload_exception(payload) payload[:exception_object] || payload[:exception] # Fallback for ActiveSupport < 5.0 end |
#report_if_exception(span, payload) ⇒ Object
54 55 56 57 |
# File 'lib/datadog/tracing/contrib/active_support/notifications/event.rb', line 54 def report_if_exception(span, payload) exception = payload_exception(payload) span.set_error(payload[:exception]) if exception end |
#span_options ⇒ Object
50 51 52 |
# File 'lib/datadog/tracing/contrib/active_support/notifications/event.rb', line 50 def {} end |
#subscribe(pattern = nil, span_name = nil, options = nil) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/datadog/tracing/contrib/active_support/notifications/event.rb', line 35 def subscribe(pattern = nil, span_name = nil, = nil) if supported? super( pattern || event_name, span_name || self.span_name, || , &method(:process) ) end end |
#subscribe! ⇒ Object
Publicly exposes protected method ‘subscribe!`
23 24 25 |
# File 'lib/datadog/tracing/contrib/active_support/notifications/event.rb', line 23 def subscribe! # rubocop:disable Lint/UselessMethodDefinition super end |
#subscription(span_name = nil, options = nil) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/datadog/tracing/contrib/active_support/notifications/event.rb', line 27 def subscription(span_name = nil, = nil) super( span_name || self.span_name, || , &method(:process) ) end |
#supported? ⇒ Boolean
46 47 48 |
# File 'lib/datadog/tracing/contrib/active_support/notifications/event.rb', line 46 def supported? true end |