Skip to main content

Module observability

Module observability 

Source

Modules§

metrics

Constants§

LOG_DIR_ENV_VAR
Overrides the default <data-dir>/logs location for the durable JSONL log file this module writes – mirrors commands::keyring::store::Store’s PIGEON_CONFIG_DIR precedent, for the same reason: isolating tests (and manual use) from the real per-OS data directory (ADR-0073).

Functions§

init
Initializes the global tracing subscriber: a JSON-formatted, non-blocking file layer (the durable “review this run later” artifact, ADR-0073) plus an ErrorLayer (so tracing_error::SpanTrace::capture() works from anywhere spans are active). Deliberately registers no console layer – ADR-0013/0014/0015’s indicatif/MultiProgress progress bars must never share stdout/stderr with a second, independent writer. Returns a WorkerGuard that must be kept alive for the whole process; dropping it early silently truncates buffered log lines.
install_panic_hook
Runs f (one full command dispatch) inside a command-named tracing span carrying command_name, logging its elapsed time and exit code on completion (ADR-0073). Sound with a plain span.enter() guard here specifically because every command dispatch in this crate is fully synchronous end to end – each async job builds and block_ons its own tokio runtime internally, so from this function’s frame the whole call is one opaque synchronous closure with zero .await in it. Anywhere .await is actually present, use #[tracing::instrument]/ .instrument(span) instead – never a manual span.enter() guard held across an await point. Re-exports panic::install_panic_hook for main.rs, which lives in a separate (binary) crate and so can’t reach a pub(crate) item directly.