Expand description
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-sinksCargo feature:HttpSink(JSON POST to an HTTPS endpoint) andOtlpSink(OTLP/gRPC or OTLP/HTTP export). Both callEvent::redactedbefore 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.
Re-exports§
pub use consent::Consent;pub use consent::ConsentState;pub use context::CollectionPolicy;pub use context::TelemetryContext;pub use context::TelemetryContextBuilder;pub use error::TelemetryError;pub use event::Event;pub use machine::MachineId;pub use sink::FileSink;pub use sink::MemorySink;pub use sink::NoopSink;pub use sink::TelemetrySink;
Modules§
- consent
- Persisted user consent for telemetry collection.
- context
TelemetryContext— the main user-facing entry point.- error
- Typed errors for the telemetry subsystem.
- event
- The
Eventemitted for each telemetry record. - machine
- Machine-ID derivation with a per-tool salt.
- sink
TelemetrySinktrait and the three built-in implementations.