Raxol.Core.Events.TelemetryAdapter (Raxol Core v2.4.0)

Copy Markdown View Source

Adapter to migrate from EventManager to :telemetry.

This module provides a compatibility layer to gradually migrate the event system from the custom EventManager to the standard :telemetry library.

Trace Context

All events automatically include trace context (trace_id, span_id) when available. Use Raxol.Core.Telemetry.TraceContext to start traces and spans.

Example

alias Raxol.Core.Telemetry.TraceContext

# Start a trace for a request
TraceContext.start_trace()

# All events will now include trace_id
TelemetryAdapter.dispatch(:my_event, %{value: 42})
# => Emits event with metadata: %{trace_id: "abc123", span_id: "def456", ...}

Summary

Functions

Dispatches an event using telemetry.

Unregisters a handler using telemetry.

Functions

dispatch(event_name, data \\ %{})

Dispatches an event using telemetry.

Converts EventManager dispatch calls to telemetry execute calls. Automatically includes trace context when available.

register_handler(handler_id, event_pattern, handler_fun, config \\ [])

Registers a handler using telemetry.

Converts EventManager handler registration to telemetry attach.

unregister_handler(handler_id)

Unregisters a handler using telemetry.