pub struct Telemetry {
pub counters: Arc<Counters>,
/* private fields */
}Fields§
§counters: Arc<Counters>Implementations§
Source§impl Telemetry
impl Telemetry
pub fn init(cfg: ResolvedConfig, app_version: String) -> Arc<Self>
Sourcepub fn track(&self, event: Event)
pub fn track(&self, event: Event)
Non-blocking emit. Drops silently on backpressure or if disabled.
Sourcepub async fn shutdown(&self, timeout: Duration)
pub async fn shutdown(&self, timeout: Duration)
Signal the sender task to drain mpsc→disk, force-roll the current segment,
and attempt one HTTP send before the process exits. The whole operation
is bounded by timeout (default exit budget is 500ms); if the network call
outruns the budget the future is cancelled and the segment stays on disk
for the next process to pick up.
We intentionally do not close the mpsc channel: self.tx is shared
(Arc<Telemetry>), and closing would race with concurrent callers.
Instead we use a oneshot to ask the task to exit cleanly.
Sourcepub fn set_account_id(&self, id: Option<String>)
pub fn set_account_id(&self, id: Option<String>)
Update the active account ID. Pass Some(id) after a successful login
(call this before emitting login_success so the event itself carries
the id) and None after logout. All subsequent events emitted by this
process will carry the new value via the envelope.
Sourcepub fn set_session_id(&self, id: Uuid)
pub fn set_session_id(&self, id: Uuid)
Update the active session ID (e.g. when a new AtomCode session is established or the user switches session via /session or /resume).