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
61 62 63 64 |
# File 'lib/datadog/tracing/contrib/active_support/notifications/event.rb', line 61 def payload_exception(payload) payload[:exception_object] || payload[:exception] # Fallback for ActiveSupport < 5.0 end |
#report_if_exception(span, payload) ⇒ Object
56 57 58 59 |
# File 'lib/datadog/tracing/contrib/active_support/notifications/event.rb', line 56 def report_if_exception(span, payload) exception = payload_exception(payload) span.set_error(payload[:exception]) if exception end |
#span_options ⇒ Object
52 53 54 |
# File 'lib/datadog/tracing/contrib/active_support/notifications/event.rb', line 52 def {} end |
#subscribe(pattern = nil, span_name = nil, options = nil) ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/datadog/tracing/contrib/active_support/notifications/event.rb', line 37 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!`
25 26 27 |
# File 'lib/datadog/tracing/contrib/active_support/notifications/event.rb', line 25 def subscribe! # rubocop:disable Lint/UselessMethodDefinition super end |
#subscription(span_name = nil, options = nil) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/datadog/tracing/contrib/active_support/notifications/event.rb', line 29 def subscription(span_name = nil, = nil) super( span_name || self.span_name, || , &method(:process) ) end |
#supported? ⇒ Boolean
48 49 50 |
# File 'lib/datadog/tracing/contrib/active_support/notifications/event.rb', line 48 def supported? true end |