agentd/obs/mod.rs
1// SPDX-License-Identifier: AGPL-3.0-only
2//! Observability. The default build ships three dependency-free things: a
3//! hand-rolled JSON-lines logger to stderr, a tiny health surface, and W3C
4//! trace-context propagation. Only the heavier surfaces (metrics, OTLP export)
5//! are feature-gated.
6//!
7//! Invariant: **stdout is the agent's result; stderr is all telemetry.**
8
9pub mod health;
10pub mod log;
11// W3C trace-context *propagation* is default-on and dependency-free (a few
12// formatted fields). Only span *export* (OTLP) is gated behind `otel` (added
13// inside `trace.rs`).
14pub mod trace;
15
16// The metrics *module* is always compiled, but its `record_*` fns are no-ops
17// unless built `--features metrics` (the atomic registry + Prometheus render +
18// `/metrics` surface are gated). This keeps call sites clean and the default
19// build cost-free.
20pub mod metrics;
21
22// The opt-in HTTP probe/scrape surface (/metrics + /healthz + /readyz) is the
23// one piece that needs a listener thread, so it is gated with the registry.
24#[cfg(feature = "metrics")]
25pub mod serve;
26
27// OTLP span export (GenAI semconv). Always compiled, but the `RunSpan` recorder
28// (run span + `chat`/`execute_tool` children) is a no-op unless built
29// `--features otel` (the OTLP encoder + HTTP export are gated) — clean loop call
30// sites, zero default cost. Hand-rolled, dep-free.
31pub mod otel;