Available on crate feature
metrics
only.Expand description
Support for metrics that get removed from their corresponding metrics vector when dropped.
§Ownership & life times
This kind of data type is realized by a struct that retains ownership of the labels used to create the spin-off metric. The created metric follows these rules:
- When passing references, the metric must not outlive the references to the labels used to create
it: A
'static
slice of static strings means the metric is allowed to live for the'static
lifetime as well. - Metrics created from references to dynamically constructed labels can only live as long as those labels do.
- When using owned data (an extension over what Prometheus allows, which only lets you use
references to refer to labels), the created metric is also allowed to live for
'static
.
Structs§
- Delete
OnDrop Metric - A
Metric
wrapper that deletes its labels from the vec when it is dropped.
Traits§
- Metric
VecExt - Extension trait for metrics vectors.
- Metric
Vec_ - A trait that allows being generic over
MetricVec
s. - Prom
Labels Ext - An extension trait for types that are valid (or convertible into) prometheus labels:
slices/vectors of strings, and
BTreeMap
s.
Type Aliases§
- Delete
OnDrop Counter - A
GenericCounter
wrapper that deletes its labels from the vec when it is dropped. - Delete
OnDrop Gauge - A
GenericGauge
wrapper that deletes its labels from the vec when it is dropped. - Delete
OnDrop Histogram - A
Histogram
wrapper that deletes its labels from the vec when it is dropped. - Prom
Label 🔒Map - The
prometheus
API uses theHashMap
type to pass metrics labels, so we have to allow its usage when calling that API.