Class: TIMEx::Telemetry::Adapters::ActiveSupportNotifications
- Defined in:
- lib/timex/telemetry/adapters.rb
Overview
Bridges TIMEx events to ActiveSupport::Notifications.
Constant Summary collapse
- EVENT_PREFIX =
"timex."
Instance Method Summary collapse
- #finish(event:, payload:) ⇒ void
-
#initialize ⇒ ActiveSupportNotifications
constructor
A new instance of ActiveSupportNotifications.
- #start(event:, payload:) ⇒ void
Methods inherited from Base
Constructor Details
#initialize ⇒ ActiveSupportNotifications
Returns a new instance of ActiveSupportNotifications.
86 87 88 89 |
# File 'lib/timex/telemetry/adapters.rb', line 86 def initialize super require "active_support/notifications" end |
Instance Method Details
#finish(event:, payload:) ⇒ void
This method returns an undefined value.
102 103 104 105 106 107 |
# File 'lib/timex/telemetry/adapters.rb', line 102 def finish(event:, payload:) token = payload.delete(:__asn_token) return unless token ::ActiveSupport::Notifications.instrumenter.finish_with_state(token, "#{EVENT_PREFIX}#{event}", payload) end |
#start(event:, payload:) ⇒ void
This method returns an undefined value.
94 95 96 97 |
# File 'lib/timex/telemetry/adapters.rb', line 94 def start(event:, payload:) instrumenter = ::ActiveSupport::Notifications.instrumenter payload[:__asn_token] = instrumenter.start("#{EVENT_PREFIX}#{event}", payload) end |