Struct prometheus::core::Desc

source ·
pub struct Desc {
    pub fq_name: String,
    pub help: String,
    pub const_label_pairs: Vec<LabelPair>,
    pub variable_labels: Vec<String>,
    pub id: u64,
    pub dim_hash: u64,
}
Expand description

The descriptor used by every Prometheus Metric. It is essentially the immutable meta-data of a metric. The normal metric implementations included in this package manage their Desc under the hood.

Descriptors registered with the same registry have to fulfill certain consistency and uniqueness criteria if they share the same fully-qualified name: They must have the same help string and the same label names (aka label dimensions) in each, constLabels and variableLabels, but they must differ in the values of the constLabels.

Descriptors that share the same fully-qualified names and the same label values of their constLabels are considered equal.

Fields§

§fq_name: String

fq_name has been built from Namespace, Subsystem, and Name.

§help: String

help provides some helpful information about this metric.

§const_label_pairs: Vec<LabelPair>

const_label_pairs contains precalculated DTO label pairs based on the constant labels.

§variable_labels: Vec<String>

variable_labels contains names of labels for which the metric maintains variable values.

§id: u64

id is a hash of the values of the ConstLabels and fqName. This must be unique among all registered descriptors and can therefore be used as an identifier of the descriptor.

§dim_hash: u64

dim_hash is a hash of the label names (preset and variable) and the Help string. Each Desc with the same fqName must have the same dimHash.

Implementations§

source§

impl Desc

source

pub fn new( fq_name: String, help: String, variable_labels: Vec<String>, const_labels: HashMap<String, String> ) -> Result<Desc>

Initializes a new Desc. Errors are recorded in the Desc and will be reported on registration time. variableLabels and constLabels can be nil if no such labels should be set. fqName and help must not be empty.

Trait Implementations§

source§

impl Clone for Desc

source§

fn clone(&self) -> Desc

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Desc

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Desc

§

impl Send for Desc

§

impl Sync for Desc

§

impl Unpin for Desc

§

impl UnwindSafe for Desc

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.