OpentelemetryStatifier.Persistence.Handler (OpentelemetryStatifier v0.4.0)

Copy Markdown View Source

The :telemetry handler attached to every name OpentelemetryStatifier.Persistence.events/0 returns.

Same defensive posture as OpentelemetryStatifier.Handler, for the same reason: no try/rescue, because :telemetry detaches a raising handler for the VM's lifetime and the per-event handler ids bound that loss to one event name. What this module owes instead is clause exhaustiveness - every clause binds only the keys it needs, and a malformed event falls through to the catch-all and drops a span rather than raising inside a host's durable step.

Three shapes, decided by the contract rather than by this module (statifier_persistence's docs/telemetry.md):

  • the step seam is a pair, and becomes a span;
  • [..., :adapter, :call] and [..., :run, :lock] are points that carry a duration, and become spans back-dated by it;
  • everything else is a point, and becomes a span event on the step span open around it.

Summary

Functions

handle_event(event, measurements, metadata, config)

@spec handle_event(
  :telemetry.event_name(),
  map(),
  map(),
  OpentelemetryStatifier.Config.t()
) :: :ok