Snodo.Instrumentation behaviour (snodo v0.1.0)

Copy Markdown View Source

Optional, dependency-free lifecycle instrumentation.

Instrumentation sinks receive telemetry-shaped event names, numeric measurements, and deliberately bounded metadata. Sink failures are isolated: observability cannot change protocol, transport, or Tasks behavior.

A sink may bridge events to :telemetry, OpenTelemetry, Logger, a metrics process, or a test collector without making any of those systems a framework dependency.

Summary

Functions

Emits one event and isolates every sink failure.

Normalizes and validates an optional sink configuration.

Types

config()

@type config() :: module() | {module(), term()} | Snodo.Instrumentation.Config.t()

event_name()

@type event_name() :: [atom()]

Callbacks

handle_event(event_name, measurements, metadata, options)

@callback handle_event(
  event_name(),
  measurements :: map(),
  metadata :: map(),
  options :: term()
) :: term()

Functions

emit(arg1, event_name, measurements, metadata)

@spec emit(Snodo.Instrumentation.Config.t() | nil, event_name(), map(), map()) :: :ok

Emits one event and isolates every sink failure.

normalize!(config)

@spec normalize!(config() | nil) :: Snodo.Instrumentation.Config.t() | nil

Normalizes and validates an optional sink configuration.