Skip to main content

Module telemetry

Module telemetry 

Source
Expand description

Local tracing init (stderr + optional XDG rotated JSON; no remote export). Local-only tracing init for the one-shot CLI (rules_rust_logs_com_tracing_e_rotacao).

§Product law

  • No remote telemetry: no OpenTelemetry, OTLP, Sentry, or log shipping.
  • stderr by default: agent pipelines keep stdout for JSON envelopes.
  • Optional XDG file: config set log_to_file true writes rotated JSON under $XDG_STATE_HOME/browser-automation-cli/log/ (never cloud).
  • No RUST_LOG product path: filter comes from argv (-q/-v/--debug) or XDG log_level (default error).
  • Daemon-only rules N/A: reload::Layer admin HTTP, OTEL sampling, journald, Lambda flush, encrypted-at-rest pipelines — not applicable to BORN→DIE.

§Targets emitted

Prefer browser_automation_cli::<module> (crate name with underscores). The telemetry module itself logs browser_automation_cli::telemetry on successful init.

§Lifecycle

[init_telemetry] installs the global subscriber once (from crate::run) and returns a [TelemetryGuard]. When file logging is enabled, the guard owns a tracing_appender [WorkerGuard] so buffered lines flush on drop at process end. Hold the guard until FINALIZE completes — do not mem::forget it.

Structs§

TelemetryGuard
Process-scoped telemetry handle. Drop flushes the optional non-blocking file worker.
TelemetryOpts
Inputs for local tracing (mirrors CLI globals + XDG).

Constants§

LOG_FILE_PREFIX
Filename prefix for rotated logs (browser-automation-cli.YYYY-MM-DD).
MAX_LOG_FILES
Maximum retained daily log files under XDG state (retention ≈ 2 weeks).

Functions§

init_telemetry
Install the global tracing subscriber (once) and return a process-lifetime guard.
resolve_filter_directive
Resolve the EnvFilter directive string (testable pure function).