pub struct Histogram { /* private fields */ }
Expand description

A Metric counts individual observations from an event or sample stream in configurable buckets. Similar to a Summary, it also provides a sum of observations and an observation count.

On the Prometheus server, quantiles can be calculated from a Histogram using the histogram_quantile function in the query language.

Note that Histograms, in contrast to Summaries, can be aggregated with the Prometheus query language (see the prometheus documentation for detailed procedures). However, Histograms require the user to pre-define suitable buckets, (see linear_buckets and exponential_buckets for some helper provided here) and they are in general less accurate. The Observe method of a Histogram has a very low performance overhead in comparison with the Observe method of a Summary.

Implementations

with_opts creates a Histogram with the opts options.

Add a single observation to the Histogram.

Return a HistogramTimer to track a duration.

Observe execution time of a closure, in second.

Return a LocalHistogram for single thread usage.

Return accumulated sum of all samples.

Return count of all samples.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Return descriptors for metrics.

Collect metrics.

Formats the value using the given formatter. Read more

Return the protocol Metric.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.