PrometheusMetric

Trait PrometheusMetric 

Source
pub trait PrometheusMetric:
    Collector
    + Clone
    + Send
    + Sync
    + 'static {
    // Required method
    fn with_opts(opts: Opts) -> Result<Self, Error>
       where Self: Sized;

    // Provided methods
    fn with_histogram_opts_and_buckets(
        _opts: HistogramOpts,
        _buckets: Option<Vec<f64>>,
    ) -> Result<Self, Error>
       where Self: Sized { ... }
    fn with_opts_and_label_names(
        _opts: Opts,
        _label_names: &[&str],
    ) -> Result<Self, Error>
       where Self: Sized { ... }
}
Expand description

Trait that defines common behavior for Prometheus metric types

Required Methods§

Source

fn with_opts(opts: Opts) -> Result<Self, Error>
where Self: Sized,

Create a new metric with the given options

Provided Methods§

Source

fn with_histogram_opts_and_buckets( _opts: HistogramOpts, _buckets: Option<Vec<f64>>, ) -> Result<Self, Error>
where Self: Sized,

Create a new metric with histogram options and custom buckets This is a default implementation that will panic for non-histogram metrics

Source

fn with_opts_and_label_names( _opts: Opts, _label_names: &[&str], ) -> Result<Self, Error>
where Self: Sized,

Create a new metric with counter options and label names (for CounterVec) This is a default implementation that will panic for non-countervec metrics

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl PrometheusMetric for Histogram

Source§

impl PrometheusMetric for Counter

Source§

fn with_opts(opts: Opts) -> Result<Self, Error>

Source§

impl PrometheusMetric for CounterVec

Source§

fn with_opts(_opts: Opts) -> Result<Self, Error>

Source§

fn with_opts_and_label_names( opts: Opts, label_names: &[&str], ) -> Result<Self, Error>

Source§

impl PrometheusMetric for IntCounter

Source§

fn with_opts(opts: Opts) -> Result<Self, Error>

Source§

impl PrometheusMetric for IntCounterVec

Source§

fn with_opts(_opts: Opts) -> Result<Self, Error>

Source§

fn with_opts_and_label_names( opts: Opts, label_names: &[&str], ) -> Result<Self, Error>

Source§

impl PrometheusMetric for Gauge

Source§

fn with_opts(opts: Opts) -> Result<Self, Error>

Source§

impl PrometheusMetric for IntGauge

Source§

fn with_opts(opts: Opts) -> Result<Self, Error>

Source§

impl PrometheusMetric for IntGaugeVec

Source§

fn with_opts(_opts: Opts) -> Result<Self, Error>

Source§

fn with_opts_and_label_names( opts: Opts, label_names: &[&str], ) -> Result<Self, Error>

Implementors§