The bridge half for statifier_persistence's own event family,
[:statifier_persistence, ...] - the durable stepper's storage
phases, frozen by that package's docs/adr/0009-telemetry-events-for-the-durable-stepper.md
and tabulated in its docs/telemetry.md.
It is a separate setup call, per st-ADR-0062 and ots-ADR-0002
decision 2: a host that steps durably calls
OpentelemetryStatifier.setup()
OpentelemetryStatifier.Persistence.setup()the shape opentelemetry_ecto and opentelemetry_oban compose in.
Nothing here attaches unless the host asks for it, and a host with no
durable stepper pays nothing.
What it produces
[:statifier_persistence, :run, :step, :start] / [..., :stop] is the
one paired seam the sibling contracts define, and it becomes a
statifier_persistence.run.step span - the interval the durable
stepper owns and nothing else measures: lock, load, decode,
identity-check, advance, execute effects, persist. The macrostep span
for the step nests inside it, as do the statifier_persistence.adapter.call
and statifier_persistence.run.lock spans, so a durable run reads as
one tree rather than as two unrelated families. The nesting runs
through this bridge's own span table, not the process's ambient OTel
context (docs/adr/0004-sibling-setup-calls-and-bridge-owned-nesting.md).
Every other event in the family is a point: a span event on the step span open around it, or its own zero-duration span when there is none.
What it does not do
statifier_persistence also emits the interpreter's family with
driver: :persistence (st-ADR-0067), and that needs no bridge work of
its own - OpentelemetryStatifier.setup/1 already attaches it, and the
driver metadata maps to statifier.driver through the mapping the
bridge already has. Attaching this module without that one produces
step spans with nothing inside them.
The event list
The 14 names below are literal here rather than read from
StatifierPersistence.Telemetry.events/0, because this package takes
no dependency on its siblings: a bridge that made statifier_persistence
(and through it Ecto, and a database driver) a dependency of every host
that wants statechart tracing would have the dependency direction
exactly backwards. The contract is frozen upstream by an accepted ADR
and the two lists are checked against each other by hand at each
sibling release; ots-41k carries the drift test that compares them
automatically once statifier_persistence is on Hex with events/0.
Summary
Functions
The event names this module attaches to - statifier_persistence's
family two, in full.
Validates opts into a OpentelemetryStatifier.Config.t() and attaches
this module's handler to every name events/0 returns, one
:telemetry.attach/4 call per name under a per-event handler id -
ADR-0003 decision 2's discipline, so a raise while handling one event
name costs that name and nothing else.
Detaches every handler id this module owns. Always returns :ok, even
when nothing was attached.
Functions
@spec events() :: [:telemetry.event_name()]
The event names this module attaches to - statifier_persistence's
family two, in full.
Examples
iex> length(OpentelemetryStatifier.Persistence.events())
14
@spec setup() :: :ok | {:error, term()}
Attaches this family with default options. Delegates to setup/1.
Examples
iex> OpentelemetryStatifier.Persistence.setup()
:ok
Validates opts into a OpentelemetryStatifier.Config.t() and attaches
this module's handler to every name events/0 returns, one
:telemetry.attach/4 call per name under a per-event handler id -
ADR-0003 decision 2's discipline, so a raise while handling one event
name costs that name and nothing else.
Idempotent, exactly as OpentelemetryStatifier.setup/1 is: the ids this
module owns are detached before they are attached, so a second call
replaces the first attachment. The two setups are independent - this one
detaches and attaches nothing outside its own family.
@spec teardown() :: :ok
Detaches every handler id this module owns. Always returns :ok, even
when nothing was attached.