// SPDX-License-Identifier: AGPL-3.0-only
//! Observability. The default build ships three dependency-free things: a
//! hand-rolled JSON-lines logger to stderr, a tiny health surface, and W3C
//! trace-context propagation. Only the heavier surfaces (metrics, OTLP export)
//! are feature-gated.
//!
//! Invariant: **stdout is the agent's result; stderr is all telemetry.**
// W3C trace-context *propagation* is default-on and dependency-free (a few
// formatted fields). Only span *export* (OTLP) is gated behind `otel` (added
// inside `trace.rs`).
// The metrics *module* is always compiled, but its `record_*` fns are no-ops
// unless built `--features metrics` (the atomic registry + Prometheus render +
// `/metrics` surface are gated). This keeps call sites clean and the default
// build cost-free.
// The opt-in HTTP probe/scrape surface (/metrics + /healthz + /readyz) is the
// one piece that needs a listener thread, so it is gated with the registry.
// OTLP span export (GenAI semconv). Always compiled, but the `RunSpan` recorder
// (run span + `chat`/`execute_tool` children) is a no-op unless built
// `--features otel` (the OTLP encoder + HTTP export are gated) — clean loop call
// sites, zero default cost. Hand-rolled, dep-free.