class
ActiveSupport::StructuredEventSubscriber
v8.1.1 -
Show latest stable
- Superclass: ActiveSupport::Subscriber
Active Support Structured Event Subscriber
+ActiveSupport::StructuredEventSubscriber+ consumes ActiveSupport::Notifications in order to emit structured events via Rails.event.
An example would be the Action Controller structured event subscriber, responsible for emitting request processing events:
module ActionController class StructuredEventSubscriber < ActiveSupport::StructuredEventSubscriber attach_to :action_controller def start_processing(event) emit_event("controller.request_started", controller: event.payload[:controller], action: event.payload[:action], format: event.payload[:format] ) end end end
After configured, whenever a "start_processing.action_controller" notification is published, it will properly dispatch the event (+ActiveSupport::Notifications::Event+) to the start_processing method. The subscriber can then emit a structured event via the emit_event method.
Constants
DEBUG_CHECK = proc { !ActiveSupport.event_reporter.debug_mode? }
Attributes
| [W] | silenced_events |
Files
- activesupport/lib/active_support/structured_event_subscriber.rb