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

Traits

  • Extension trait for all gauge metrics vectors.
  • Extension trait for all metrics vectors.
  • Extension trait for all gauge metrics vectors.
  • An extension trait for types that are valid (or convertible into) prometheus labels: slices/vectors of strings, and BTreeMaps.