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
//! Opt-in anonymous telemetry.
//!
//! # Two-level opt-in
//!
//! Tool authors enable telemetry at compile time by depending on
//! this crate (and, via the `rtb` umbrella, by turning on the
//! `telemetry` Cargo feature). Users opt in separately at runtime by
//! setting the context's [`CollectionPolicy`] to `Enabled`. The
//! default is [`CollectionPolicy::Disabled`] — no events emitted,
//! no machine ID derived, no sink calls.
//!
//! # Machine identity
//!
//! `MachineId::derive(salt)` returns `sha256(salt || machine_uid)`
//! hex-encoded. The raw machine ID never leaves this crate. Rotate
//! the salt to invalidate existing identities.
//!
//! # Sinks
//!
//! - Always available: [`NoopSink`] (always-Ok drop), [`MemorySink`]
//! (test fixture), [`FileSink`] (newline-delimited JSON on disk).
//! - Behind the `remote-sinks` Cargo feature: `HttpSink` (JSON
//! POST to an HTTPS endpoint) and `OtlpSink` (OTLP/gRPC or
//! OTLP/HTTP export). Both call [`Event::redacted`] before
//! serialisation.
//!
//! See `docs/development/specs/2026-04-22-rtb-telemetry-v0.1.md` and
//! `docs/development/specs/2026-04-24-rtb-telemetry-http-otlp-sinks.md`
//! for the authoritative contracts.
pub use ;
pub use ;
pub use TelemetryError;
pub use Event;
pub use MachineId;
pub use ;
pub use ;
pub use ;