OpentelemetryStatifier. Persistence. Handler
(OpentelemetryStatifier v0.8.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:
:startopens it and exactly one of:stopor:exceptioncloses it, the latter with an error status; [..., :adapter, :call]and[..., :execution, :lock]are points that carry aduration, and become spans back-dated by it;- everything else is a point, and becomes a span event on the step
span open around it -
[..., :step, :reentered]included, which has four segments but nospan_ref, and so is a point rather than a half of the pair.
Of the family's three list-valued keys, :reentered's opts renders
with inspect/1 before the attribute rules see it, which would
otherwise drop a list, and :migrated's dropped becomes a sorted
string-array attribute, as configuration does
(OpentelemetryStatifier.Persistence's moduledoc says why); the third,
:exception's stacktrace, is left to the rules and dropped as an
attribute, and travels instead as the exception.stacktrace of the
exception span event the close records.
Summary
Functions
@spec handle_event( :telemetry.event_name(), map(), map(), OpentelemetryStatifier.Config.t() ) :: :ok