Skip to main content

TelemetryConfig

Struct TelemetryConfig 

Source
#[non_exhaustive]
pub struct TelemetryConfig { /* private fields */ }
Expand description

Runtime configuration for the telemetry subsystem.

Constructed via TelemetryConfig::default (which locks in the privacy-preserving defaults) and refined with the with_* builder methods. Fields are crate-private; read them through the accessor methods and mutate them through the builder methods — this keeps a single idiom for configuration and prevents mid-run mutation of identity-correlation parameters like the scrub secret (which would invalidate every previously emitted opaque identifier).

The struct is #[non_exhaustive] to preserve room for future knobs.

Implementations§

Source§

impl TelemetryConfig

Source

pub fn with_scrub_ids(self, scrub_ids: bool) -> Self

Sets the identifier-scrubbing flag.

When true (the default), long-lived pseudonymous identifiers (peer_id, user_id, app_id, group_id) are hashed before crossing the telemetry sink boundary — third-party sinks (analytics, crash reporters) must not receive raw identifiers by default.

Source

pub fn with_mls_verbosity(self, mls_verbosity: MlsVerbosity) -> Self

Sets the MLS lifecycle verbosity tier.

Source

pub fn with_metrics_cadence(self, cadence: Option<Duration>) -> Self

Sets the cadence for periodic MetricsSnapshot emission. None disables periodic emission entirely (apps fall back to pull-based access via TransportManager::metrics()).

Source

pub fn with_scrub_secret(self, secret: Option<[u8; 16]>) -> Self

Sets the opaque-identifier hashing secret.

Supplying Some(secret) pins an explicit, caller-owned secret and always takes precedence over the SDK-managed fallback below.

Supplying None (the default) leaves the secret unset in the config. In that case the SDK manages the fallback for you: the first time secure storage is provided via OfflineProtocol::initialize_mls, the SDK loads — or, on first run, generates and persists — a stable per-install secret. This makes opaque identifiers survive process restarts, so backend telemetry can count distinct devices across sessions. Until storage is available (or if storage is never provided), the SDK uses a random per-instance secret derived at protocol construction.

Precedence: explicit config secret > SDK-managed persistent secret > random per-instance secret.

Do not share the secret across tenants, and do not rotate it mid-run — rotation invalidates every previously emitted opaque identifier and breaks correlation on the receiving side. For the SDK-managed fallback this means: do not back two tenants with the same storage, and do not clear the scrub_secret storage entry within a measurement window.

Source

pub fn scrub_ids(&self) -> bool

Returns whether identifier scrubbing is enabled.

Source

pub fn mls_verbosity(&self) -> MlsVerbosity

Returns the configured MLS lifecycle verbosity tier.

Source

pub fn metrics_cadence(&self) -> Option<Duration>

Returns the configured periodic metrics-snapshot cadence.

Source

pub fn with_routing_diagnostic(self, routing_diagnostic: bool) -> Self

Sets whether RoutingDecision records should carry the full per-transport score breakdown.

When true, every emitted crate::telemetry::RoutingDecision::scores is populated with the seven-factor offline_protocol_router::TransportScore for each ranked transport. When false (the default), scores is empty — the hot path avoids the per-emission vector allocation and Diagnostic-tier consumers simply see an empty vector.

Leaf identifiers are not affected: this knob only gates the scoring-factor detail, not identity fields.

Source

pub fn routing_diagnostic(&self) -> bool

Returns whether routing records should carry diagnostic score detail.

Source

pub fn with_mls_sampling_bypass(self, mls_sampling_bypass: bool) -> Self

Opts the installed sink out of MLS lifecycle event rate limiting.

By default (false), high-volume MLS lifecycle events (mls.decryption_failed, mls.session_missing) pass through a best-effort fixed-window limiter that caps emission per peer+kind. The cap protects naïve sinks from event floods, but it also clips genuine failure spikes to the per-window ceiling — an aggregating backend cannot tell a real burst of N failures apart from the cap.

Setting this to true disables that limiter so a telemetry-grade sink receives every MLS lifecycle event un-sampled, and aggregate counts reflect reality. Only enable it for sinks that apply their own backpressure (for example, pushing onto a bounded channel and draining on a background task per the TelemetrySink contract) — an unbuffered sink that does real work inline can be overwhelmed by an un-capped failure spike.

This knob only affects MLS-event rate limiting; it does not change identifier scrubbing, verbosity, or any other field.

Source

pub fn mls_sampling_bypass(&self) -> bool

Returns whether MLS lifecycle event rate limiting is bypassed.

Trait Implementations§

Source§

impl Clone for TelemetryConfig

Source§

fn clone(&self) -> TelemetryConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TelemetryConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TelemetryConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Classify for T

Source§

type Classified = T

Source§

fn classify(self) -> T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Declassify for T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more