1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Process-wide opt-in gate for telemetry, visible from both the bin
//! and lib crates.
//!
//! `src/telemetry.rs` is currently bin-private (declared as `mod
//! telemetry` in `main.rs`). Code that lives in modules also declared
//! by `lib.rs` (e.g. `src/packages/*`, `src/observability/*`) cannot
//! reach `crate::telemetry::is_enabled()` when compiled as part of the
//! lib crate (e.g. during `cargo test`).
//!
//! This module provides a thin `AtomicBool` gate that the lib-side
//! observability module can read, populated by `telemetry::init` at
//! startup. The atomic lives in observability so any module declared
//! by `lib.rs` can reach it. At runtime only one copy of the static
//! is live (the bin-compiled one when `jarvy` is running; the lib copy
//! only matters during `cargo test`).
//!
//! This is the load-bearing piece that prevents `package.*` /
//! `packages.*` events from leaking to OTLP when the user explicitly
//! set `telemetry.enabled = false` — the prior round emitted raw
//! `tracing::*` to dodge the visibility wall, which broke the
//! documented opt-in contract.
use ;
static TELEMETRY_ENABLED: AtomicBool = new;
/// Mark telemetry as enabled. Called from `telemetry::init` at startup
/// once the resolved configuration is known. Idempotent.
/// Read the current opt-in state. Callers in `src/packages/*` and
/// other lib-side modules use this in place of
/// `telemetry::is_enabled()` so events fire only when the user
/// consented.