Module: Skylight::Probes::ActiveRecord::FutureResult::AsyncEventExtensions Private
- Defined in:
- lib/skylight/probes/active_record_async.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Applied to ActiveSupport::Notifications::Event
Instance Method Summary collapse
-
#__sk_finish! ⇒ Object
private
Notify Skylight that the event has finished.
-
#__sk_start! ⇒ Object
private
Notify Skylight that the event has started.
-
#finish! ⇒ Object
private
When the event is marked as finish make sure we notify Skylight.
Instance Method Details
#__sk_finish! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Notify Skylight that the event has finished
25 26 27 28 29 30 31 32 |
# File 'lib/skylight/probes/active_record_async.rb', line 25 def __sk_finish! return unless @__sk_finisher @__sk_finisher.call(name, payload) @__sk_finisher = nil rescue StandardError => e Skylight.error("Unable to finish event for FutureResult: #{e}") end |
#__sk_start! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Notify Skylight that the event has started
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/skylight/probes/active_record_async.rb', line 8 def __sk_start! subscriber = Skylight.instrumenter.subscriber subscriber.start(name, nil, payload) trace = Skylight.instrumenter.current_trace # Set a finisher to end the event @__sk_finisher = ->(name, payload) do subscriber.with_trace(trace) { subscriber.finish(name, nil, payload) } end # End it immediately if we've actually already ended __sk_finish! if @end rescue StandardError => e Skylight.error("Unable to start event for FutureResult: #{e}") end |
#finish! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
When the event is marked as finish make sure we notify Skylight
35 36 37 38 |
# File 'lib/skylight/probes/active_record_async.rb', line 35 def finish! super __sk_finish! end |