class StructuredEventSubscriber
Ruby on Rails 8.1.2
Since v8.1.2Active 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.
Inherits from
Constants
Methods (defined here)
- # call
- # emit_debug_event
- # emit_event
- # silenced?
- self. new
Private methods
(3)
Implementation detail — not part of the public API.
- # handle_event_error
- self. debug_only
- self. set_silenced_events