pub trait Metrics: Supervisor {
// Required methods
fn register<N: Into<String>, H: Into<String>, M: Metric>(
&self,
name: N,
help: H,
metric: M,
) -> Registered<M>;
fn encode(&self) -> String;
}Expand description
Interface to register and encode metrics.
Required Methods§
Sourcefn register<N: Into<String>, H: Into<String>, M: Metric>(
&self,
name: N,
help: H,
metric: M,
) -> Registered<M>
fn register<N: Into<String>, H: Into<String>, M: Metric>( &self, name: N, help: H, metric: M, ) -> Registered<M>
Register a metric with the runtime.
Any registered metric includes the current context label as its name
prefix and the current context attributes as Prometheus labels. See
Supervisor for the identity model and examples.
The returned telemetry::metrics::Registered value must be retained for as long as the
metric should remain exposed. Dropping the returned handle unregisters
the metric immediately.
Re-registering the same metric key (same prefixed name and attributes) returns another handle to the existing metric when the concrete metric type matches. Registering the same key with a different metric type panics.
Names must start with [a-zA-Z] and contain only [a-zA-Z0-9_].
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".