Internal helpers for runtime telemetry and structured logs.
The external observability contract is documented in docs/observability.md.
This module keeps event naming and logger metadata consistent across the
runtime.
Summary
Functions
Converts a persisted UTC timestamp into a native-unit duration up to now.
Emits a telemetry event when a run is created.
Emits a telemetry event when a run is dispatched to Oban.
Emits a telemetry event when a run is replayed.
Emits a telemetry event for a run state transition.
Emits a telemetry event when a workflow step completes.
Emits a telemetry event when a workflow step fails.
Emits a telemetry event when a retry is scheduled for a workflow step.
Emits a telemetry event when a stale or duplicate step delivery is skipped.
Emits a telemetry event when a workflow step starts.
Runs a function with run-scoped logger metadata attached.
Runs a function with step-scoped logger metadata attached.
Functions
@spec duration_since(DateTime.t()) :: non_neg_integer()
Converts a persisted UTC timestamp into a native-unit duration up to now.
@spec emit_run_created(SquidMesh.Run.t()) :: :ok
Emits a telemetry event when a run is created.
@spec emit_run_dispatched( SquidMesh.Run.t(), Oban.Job.t(), atom(), pos_integer() | nil ) :: :ok
Emits a telemetry event when a run is dispatched to Oban.
@spec emit_run_replayed(SquidMesh.Run.t()) :: :ok
Emits a telemetry event when a run is replayed.
@spec emit_run_transition( SquidMesh.Run.t(), SquidMesh.Run.status(), SquidMesh.Run.status() ) :: :ok
Emits a telemetry event for a run state transition.
@spec emit_step_completed(SquidMesh.Run.t(), atom(), pos_integer(), non_neg_integer()) :: :ok
Emits a telemetry event when a workflow step completes.
@spec emit_step_failed( SquidMesh.Run.t(), atom(), pos_integer(), non_neg_integer(), map() ) :: :ok
Emits a telemetry event when a workflow step fails.
@spec emit_step_retry_scheduled( SquidMesh.Run.t(), atom(), pos_integer(), non_neg_integer() ) :: :ok
Emits a telemetry event when a retry is scheduled for a workflow step.
@spec emit_step_skipped(SquidMesh.Run.t(), atom(), String.t()) :: :ok
Emits a telemetry event when a stale or duplicate step delivery is skipped.
@spec emit_step_started(SquidMesh.Run.t(), atom(), pos_integer()) :: :ok
Emits a telemetry event when a workflow step starts.
@spec with_run_metadata(SquidMesh.Run.t(), (-> result)) :: result when result: var
Runs a function with run-scoped logger metadata attached.
@spec with_step_metadata(SquidMesh.Run.t(), atom(), pos_integer() | nil, (-> result)) :: result when result: var
Runs a function with step-scoped logger metadata attached.