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
'staticslice of static strings means the metric is allowed to live for the'staticlifetime 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
Metricwrapper 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
MetricVecs. - Prom
Labels Ext - An extension trait for types that are valid (or convertible into) prometheus labels:
slices/vectors of strings, and
BTreeMaps.
Type Aliases§
- Delete
OnDrop Counter - A
GenericCounterwrapper that deletes its labels from the vec when it is dropped. - Delete
OnDrop Gauge - A
GenericGaugewrapper that deletes its labels from the vec when it is dropped. - Delete
OnDrop Histogram - A
Histogramwrapper that deletes its labels from the vec when it is dropped. - Prom
Label 🔒Map - The
prometheusAPI uses theHashMaptype to pass metrics labels, so we have to allow its usage when calling that API.