# `Tay.Telemetry`
[🔗](https://github.com/AndriiSydorenko1904/tay/blob/v1.6.1/lib/tay/telemetry.ex#L1)

Bounded telemetry events and backend-neutral metric definitions.

Job transitions use `[:tay, :job, :transition]` with `%{count: 1}` and
metadata keys `:engine`, `:operation`, `:state`, `:previous_state`, `:queue`,
and `:job_id`. Public requests emit the standard `[:tay, :command, :start]`,
`:stop`, and `:exception` span events. Group commits use
`[:tay, :storage, :group_commit]` with native
time-unit measurements `:batch_size`, `:wait_time`, and `:fsync_duration`.
Queue controls use `[:tay, :queue, :control]` with `%{count: 1}`
and `:engine`, `:operation`, and `:queue` metadata. Arguments, diagnostics,
definitions, revisions, PIDs, and storage paths are never included.

`metrics/0` returns `Telemetry.Metrics` definitions suitable for Prometheus
reporters and other compatible backends. The definitions deliberately omit
job and schedule IDs, and queue labels are limited to configured queues.
Add `poller_child_spec/1` to a host supervision tree to publish gauges.

# `attach_opentelemetry`

Attaches Tay command spans to `opentelemetry_telemetry` when it is installed.

The host application owns the OpenTelemetry SDK, processor, and exporter.
Options are `:tracer_id` (default `:tay`) and `:handler_id`, which is also
accepted by `detach_opentelemetry/1`.

# `detach_opentelemetry`

Detaches handlers installed by `attach_opentelemetry/1`.

# `emit_snapshot`

Emits one bounded metrics snapshot for an engine.

# `events`

Returns every stable Telemetry event emitted by Tay.

# `metrics`

Returns backend-neutral, low-cardinality metric definitions.

Reporters may add their own global tags. Tay's definitions use only the
configured engine and queue names plus finite operation/state/outcome values.
Per-job and per-schedule identifiers are intentionally excluded.

# `poller_child_spec`

Returns a child specification for periodic engine and queue gauges.

---

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