Statifier.Session.Telemetry (Statifier v2.1.1)

Copy Markdown View Source

The Statifier.Session-pinned view of Statifier.Telemetry (ADR-0067 decision 2): every function here forwards to the caller-agnostic emitter with driver: :session pinned, so the nine functions 2.0.0 published keep their arities and keep working unchanged for existing consumers.

The authoritative event contract - the full @moduledoc table, every measurement/metadata shape, the location-resolution rule, and the per-driver applicability table - now lives on Statifier.Telemetry. This module carries no copy of it.

This module is superseded in documentation by Statifier.Telemetry; whether it is removed is a 3.0 question, not this record's (ADR-0067 open question 3). It is not @deprecated: this repo has no @deprecated precedent, and every function here still behaves exactly as documented.

Summary

Functions

Emits [:statifier, :session, :effect, kind] or [:statifier, :session, :trace, kind] with driver: :session, dispatching on effect's own tag.

Every event name Statifier.Session can emit - delegates to Statifier.Telemetry.events/0, which is the same 27 names.

Emits [:statifier, :session, :halt] with driver: :session.

Emits [:statifier, :session, :init] with driver: :session.

Emits [:statifier, :session, :interpret] with driver: :session.

Emits [:statifier, :session, :macrostep, :start] with driver: :session.

Emits [:statifier, :session, :macrostep, :stop] with driver: :session.

Emits [:statifier, :session, :terminate] with driver: :session.

Emits [:statifier, :session, :unroutable] with driver: :session for an effect the session could not route.

Functions

effect(session_id, machine, effect)

@spec effect(
  session_id :: String.t(),
  machine :: Statifier.Machine.t(),
  effect :: Statifier.Effect.t()
) ::
  :ok

Emits [:statifier, :session, :effect, kind] or [:statifier, :session, :trace, kind] with driver: :session, dispatching on effect's own tag.

events()

@spec events() :: [Statifier.Telemetry.event_name()]

Every event name Statifier.Session can emit - delegates to Statifier.Telemetry.events/0, which is the same 27 names.

halt(session_id, reason, machine_state)

@spec halt(
  session_id :: String.t(),
  reason :: :done | :cancelled | :budget_exhausted,
  machine_state :: Statifier.MachineState.t()
) :: :ok

Emits [:statifier, :session, :halt] with driver: :session.

init(session_id, machine, machine_state, invoked_by, resumed)

@spec init(
  session_id :: String.t(),
  machine :: Statifier.Machine.t(),
  machine_state :: Statifier.MachineState.t(),
  invoked_by :: {pid(), String.t()} | nil,
  resumed :: boolean()
) :: :ok

Emits [:statifier, :session, :init] with driver: :session.

interpret(session_id, effect_count, machine_state)

@spec interpret(
  session_id :: String.t(),
  effect_count :: non_neg_integer(),
  machine_state :: Statifier.MachineState.t()
) :: :ok

Emits [:statifier, :session, :interpret] with driver: :session.

macrostep_start(session_id, trigger, event, span_ref)

@spec macrostep_start(
  session_id :: String.t(),
  trigger :: :initialize | :event | :cancel | :internal | :resume,
  event :: Statifier.Event.t() | nil,
  span_ref :: reference()
) :: :ok

Emits [:statifier, :session, :macrostep, :start] with driver: :session.

macrostep_stop(session_id, trigger, machine_state, event, outcome, start_time, span_ref)

@spec macrostep_stop(
  session_id :: String.t(),
  trigger :: :initialize | :event | :cancel | :internal | :resume,
  machine_state :: Statifier.MachineState.t(),
  event :: Statifier.Event.t() | nil,
  outcome :: :quiescent | :done | :cancelled | :budget_exhausted,
  start_time :: integer(),
  span_ref :: reference()
) :: :ok

Emits [:statifier, :session, :macrostep, :stop] with driver: :session.

terminate(session_id, reason, status, machine_state)

@spec terminate(
  session_id :: String.t(),
  reason :: term(),
  status :: term(),
  machine_state :: Statifier.MachineState.t()
) :: :ok

Emits [:statifier, :session, :terminate] with driver: :session.

unroutable(session_id, machine, effect)

@spec unroutable(
  session_id :: String.t(),
  machine :: Statifier.Machine.t(),
  effect :: Statifier.Effect.t()
) :: :ok

Emits [:statifier, :session, :unroutable] with driver: :session for an effect the session could not route.