Class: Rage::Telemetry::Spans::PublishEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/rage/telemetry/spans/publish_event.rb

Overview

The events.event.publish span tracks the publishing of an event.

This span is triggered whenever an event is published via Rage::Events.publish. See handle for the list of arguments passed to handler methods.

Class Method Summary collapse

Class Method Details

.handle(id:, name:, event:, context:, subscriber_classes:) ⇒ Object

Note:

Rage automatically detects which parameters your handler method accepts and only passes those parameters. You can omit any of the parameters described here.

Examples:

class MyTelemetryHandler < Rage::Telemetry::Handler
  handle "events.event.publish", with: :my_handler

  def my_handler(id:, name:, event:, context:, subscriber_classes:)
    yield
  end
end

Parameters:

  • id ("events.event.publish")

    ID of the span

  • name (String)

    human-readable name of the operation (e.g., Events.publish(UpdateRecommendations))

  • event (Object)

    the event being published

  • context (Object, nil)

    the additional context passed along with the event

  • subscriber_classes (Array<Rage::Events::Subscriber>)

    the list of subscriber classes that will receive the event

Yield Returns:



18
19
# File 'lib/rage/telemetry/spans/publish_event.rb', line 18

def handle(id:, name:, event:, context:, subscriber_classes:)
end