evoq_telemetry (evoq v1.14.1)

View Source

Telemetry utilities for evoq.

Provides helper functions for attaching telemetry handlers and formatting telemetry events.

Event Naming Convention

All events follow the pattern: [evoq, component, action, stage] where stage is one of: start | stop | exception

Example Usage

  %% Attach a handler for all aggregate events
  evoq_telemetry:attach_aggregate_handlers(my_handler, fun handle_event/4).
 
  %% Attach a handler for specific events
  evoq_telemetry:attach([evoq, aggregate, execute, start], my_handler, fun handle_event/4).

Summary

Functions

Attach a telemetry handler.

Attach a telemetry handler with config.

Attach handlers for all aggregate telemetry events.

Attach handlers for ALL evoq telemetry events.

Attach handlers for all event handler telemetry events.

Attach handlers for all process manager telemetry events.

Attach handlers for all projection telemetry events.

Detach a telemetry handler.

List all attached handlers.

Execute a function within a telemetry span. Emits start and stop (or exception) events.

Functions

attach(EventName, HandlerId, HandlerFun)

-spec attach(atom() | [atom(), ...], atom(), fun(([atom(), ...], map(), map(), term()) -> term())) ->
                ok | {error, already_exists}.

Attach a telemetry handler.

attach(EventName, HandlerId, HandlerFun, Config)

-spec attach(atom() | [atom(), ...],
             atom(),
             fun(([atom(), ...], map(), map(), term()) -> term()),
             map()) ->
                ok | {error, already_exists}.

Attach a telemetry handler with config.

attach_aggregate_handlers(HandlerIdPrefix, HandlerFun)

-spec attach_aggregate_handlers(atom(), fun()) -> ok.

Attach handlers for all aggregate telemetry events.

attach_all_handlers(HandlerIdPrefix, HandlerFun)

-spec attach_all_handlers(atom(), fun()) -> ok.

Attach handlers for ALL evoq telemetry events.

attach_handler_handlers(HandlerIdPrefix, HandlerFun)

-spec attach_handler_handlers(atom(), fun()) -> ok.

Attach handlers for all event handler telemetry events.

attach_pm_handlers(HandlerIdPrefix, HandlerFun)

-spec attach_pm_handlers(atom(), fun()) -> ok.

Attach handlers for all process manager telemetry events.

attach_projection_handlers(HandlerIdPrefix, HandlerFun)

-spec attach_projection_handlers(atom(), fun()) -> ok.

Attach handlers for all projection telemetry events.

detach(HandlerId)

-spec detach(atom()) -> ok | {error, not_found}.

Detach a telemetry handler.

list_handlers()

-spec list_handlers() -> [map()].

List all attached handlers.

span(EventPrefix, Metadata, Fun)

-spec span([atom()], map(), fun(() -> term())) -> term().

Execute a function within a telemetry span. Emits start and stop (or exception) events.