[][src]Struct metrics_exporter_prometheus::PrometheusBuilder

pub struct PrometheusBuilder { /* fields omitted */ }

Builder for creating and installing a Prometheus recorder/exporter.

Implementations

impl PrometheusBuilder[src]

pub fn new() -> Self[src]

Creates a new PrometheusBuilder.

pub fn listen_address(self, addr: impl Into<SocketAddr>) -> Self[src]

Sets the listen address for the Prometheus scrape endpoint.

The HTTP listener that is spawned will respond to GET requests on any request path.

Defaults to 127.0.0.1:9000.

pub fn set_quantiles(self, quantiles: &[f64]) -> Self[src]

Sets the quantiles to use when rendering histograms.

Quantiles represent a scale of 0 to 1, where percentiles represent a scale of 1 to 100, so a quantile of 0.99 is the 99th percentile, and a quantile of 0.99 is the 99.9th percentile.

By default, the quantiles will be set to: 0.0, 0.5, 0.9, 0.95, 0.99, 0.999, and 1.0. This means that all histograms will be exposed as Prometheus summaries.

If buckets are set (via [set_buckets] or [set_buckets_for_metric]) then all histograms will be exposed as summaries instead.

pub fn set_buckets(self, values: &[u64]) -> Self[src]

Sets the buckets to use when rendering histograms.

Buckets values represent the higher bound of each buckets. If buckets are set, then all histograms will be rendered as true Prometheus histograms, instead of summaries.

pub fn set_buckets_for_metric(self, name: &str, values: &[u64]) -> Self[src]

Sets the buckets for a specific metric, overidding the default.

The match is suffix-based, and the longest match found will be used.

Buckets values represent the higher bound of each buckets. If buckets are set, then any histograms that match will be rendered as true Prometheus histograms, instead of summaries.

This option changes the observer's output of histogram-type metric into summaries. It only affects matching metrics if set_buckets was not used.

pub fn install(self) -> Result<(), Error>[src]

Builds the recorder and exporter and installs them globally.

An error will be returned if there's an issue with creating the HTTP server or with installing the recorder as the global recorder.

pub fn build(
    self
) -> (PrometheusRecorder, impl Future<Output = Result<(), HyperError>> + Send + Sync + 'static)
[src]

Builds the recorder and exporter and returns them both.

In most cases, users should prefer to use PrometheusBuilder::install to create and install the recorder and exporter automatically for them. If a caller is combining recorders, or needs to schedule the exporter to run in a particular way, this method provides the flexibility to do so.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.