Module foundations::telemetry::metrics
source · Available on (crate features
logging
or metrics
or telemetry
or tracing
) and crate feature metrics
only.Expand description
Metrics-related functionality.
Foundations provides simple and ergonomic interface to Prometheus metrics:
- Use
metrics
macro to define regular metrics. - Use
report_info
function to register service information metrics (metrics, whose value is persistent during the service lifetime, e.g. software version). - Use
collect
method to obtain metrics report programmatically. - Use telemetry server to expose a metrics endpoint.
Structs§
- A wrapper of
prometheus_client::metrics::counter::Counter
which does not suffix the name with_total
. - A wrapper around
prometheus_client::metrics::family::Family
which encodes its labels withSerialize
instead ofEncode
. - GaugeNeither MIPS nor PowerPCOpen Metrics
Gauge
to record current measurements. - Increments a gauge metric when created, and decrements it when dropped.
- Open Metrics
Histogram
to measure distributions of discrete events. - A builder suitable for
Histogram
andTimeHistogram
. - Timer to measure and record the duration of an event.
- Prometheus metric based on a gauge, but additionally records the minimum and maximum values of that gauge since the last recorded value was taken.
- A faster, lock-free histogram for tracking time.
Traits§
- Describes an info metric.
- A constructor for creating new metrics in a
Family
when callingFamily::get_or_create
. Such constructor is provided viaFamily::new_with_constructor
.
Functions§
- Collects all metrics in Prometheus text format.
- Registers an info metric, i.e. a gauge metric whose value is always
1
, set at init time.
Attribute Macros§
- A macro that allows to define a Prometheus info metric.
- A macro that allows to define Prometheus metrics.