Skip to main content

CommonLibrary/Telemetry/
mod.rs

1#![allow(non_snake_case)]
2
3//! # Telemetry - shared dual-pipe (PostHog + OTLP) for every Rust Element
4//!
5//! Single source of truth for the sidecar telemetry surface. Mountain
6//! keeps its own compile-time-baked `Binary/Build/PostHogPlugin/*`
7//! (the build.rs `cargo:rustc-env` route guarantees release builds drop
8//! every byte). All other Rust elements (Air, Echo, Rest, Grove, Mist,
9//! SideCar) read configuration at runtime through this module:
10//!
11//! ```ignore
12//! use CommonLibrary::Telemetry::{Initialize, Tier};
13//! Initialize::Fn(Tier::Air);   // call once during boot
14//! ```
15//!
16//! All capture functions are no-ops in release builds
17//! (`cfg!(debug_assertions)`) and short-circuit on `Capture=false` / per-pipe
18//! toggles at runtime.
19//!
20//! ## Layout (one export per file)
21//!
22//! - `Tier::Tier` - enum identifying the calling sidecar
23//! - `Configuration::Fn` - runtime env read
24//! - `IsAllowed::PostHog`, `IsAllowed::OTLP` - gates
25//! - `Client::CLIENT` - `OnceLock<posthog_rs::Client>`
26//! - `DistinctId::Fn` - stable per-machine identity
27//! - `CaptureEvent::Fn`, `CaptureError::Fn`, `CaptureSession::Fn` - PostHog
28//! - `EmitOTLPSpan::Fn` - raw HTTP OTLP exporter
29//! - `Initialize::Fn` - `Tier`-tagged boot
30
31pub mod CaptureError;
32pub mod CaptureEvent;
33pub mod CaptureSession;
34pub mod Client;
35pub mod Configuration;
36pub mod DistinctId;
37pub mod EmitOTLPSpan;
38pub mod Initialize;
39pub mod IsAllowed;
40pub mod Tier;
41pub mod Traceparent;