Modules
Contents
use utopia_telemetry::ObservableGauge;pub struct ObservableGauge(Arc<dyn Observe>)A gauge read when the backend collects, by callbacks that report the current values (pool sizes, queue depths), instead of being recorded on every change.
Backends share one instrument per name, so several sources (one per connection pool) can each add a callback and report their own series.
Debug.use utopia_telemetry::Observation;pub struct ObservationOne measurement an ObservableGauge callback reported.
use utopia_telemetry::Number;pub enum NumberA measurement: an integer or a float. Integers stay integers through sums, so a counter that only ever adds integers reports an integer.
Add, From, Display.use utopia_telemetry::Value;pub enum Value<'a>The value of an attribute.
From.use utopia_telemetry::Observe;pub trait Observe: Send + SyncWhat a backend does with the callbacks of an observable gauge. Implement
it, with Record, to add a backend.
use utopia_telemetry::Observer;pub trait ObserverReceives the measurements of an ObservableGauge callback.
use utopia_telemetry::Record;pub trait Record: Send + SyncWhat a backend does with a measurement of one synchronous instrument.
Implement it, with Observe, to add a backend.
use utopia_telemetry::Telemetry;pub trait Telemetry: Send + SyncCreates instruments and exports what they recorded. Implement it to add a backend.
Creating an instrument is cheap and records nothing: backends register an instrument on its first measurement, so one that never records is never exported.
use utopia_telemetry::to_owned;pub fn to_owned(attributes: Attributes<'_>) -> OwnedAttributesCopies borrowed attributes into owned ones.
pub type Attributes<'a> = &'a [(&'a str, Value<'a>)]The attributes of one measurement: (name, value) pairs, in order.
pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>A boxed future, as Telemetry::collect and transports return.
pub type Callback = Arc<dyn Fn() -> BoxFuture<'static, Vec<Observation>> + Send + Sync>A callback an ObservableGauge runs when the backend collects: it
returns the measurements to report, and may wait (on a shared store, say)
before it does.
pub type OwnedAttributes = Vec<(String, Value<'static>)>Owned attributes, as backends keep them.