# `Statifier.Session.Telemetry`
[🔗](https://github.com/riddler/statifier-ex/blob/v2.1.1/lib/statifier/session/telemetry.ex#L1)

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.

# `effect`

```elixir
@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`

```elixir
@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`

```elixir
@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`

```elixir
@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`

```elixir
@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`

```elixir
@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`

```elixir
@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`

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

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

# `unroutable`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
