Struct opentelemetry_prometheus::ExporterBuilder

source ·
pub struct ExporterBuilder { /* private fields */ }
Expand description

PrometheusExporter configuration options

Implementations§

source§

impl ExporterBuilder

source

pub fn without_units(self) -> Self

Disables exporter’s addition of unit suffixes to metric names.

By default, metric names include a unit suffix to follow Prometheus naming conventions. For example, the counter metric request.duration, with unit ms would become request_duration_milliseconds_total.

With this option set, the name would instead be request_duration_total.

source

pub fn without_counter_suffixes(self) -> Self

Disables exporter’s addition _total suffixes on counters.

By default, metric names include a _total suffix to follow Prometheus naming conventions. For example, the counter metric happy.people would become happy_people_total. With this option set, the name would instead be happy_people.

source

pub fn without_target_info(self) -> Self

Configures the exporter to not export the resource target_info metric.

If not specified, the exporter will create a target_info metric containing the metrics’ Resource attributes.

source

pub fn without_scope_info(self) -> Self

Configures the exporter to not export the otel_scope_info metric.

If not specified, the exporter will create a otel_scope_info metric containing the metrics’ Instrumentation Scope, and also add labels about Instrumentation Scope to all metric points.

source

pub fn with_namespace(self, namespace: impl Into<String>) -> Self

Configures the exporter to prefix metrics with the given namespace.

Metrics such as target_info and otel_scope_info are not prefixed since these have special behavior based on their name.

source

pub fn with_registry(self, registry: Registry) -> Self

Configures which prometheus::Registry the exporter will use.

If no registry is specified, the prometheus default is used.

source

pub fn with_aggregation_selector( self, agg: impl AggregationSelector + 'static, ) -> Self

Configure the AggregationSelector the exporter will use.

If no selector is provided, the DefaultAggregationSelector is used.

source

pub fn with_resource_selector( self, resource_selector: impl Into<ResourceSelector>, ) -> Self

Configures whether to export resource as attributes with every metric.

Note that this is orthogonal to the target_info metric, which can be disabled using without_target_info.

If you called without_target_info and with_resource_selector with ResourceSelector::None, resource will not be exported at all.

source

pub fn with_producer(self, producer: impl MetricProducer + 'static) -> Self

Registers an external MetricProducer with this reader.

The producer is used as a source of aggregated metric data which is incorporated into metrics collected from the SDK.

source

pub fn build(self) -> Result<PrometheusExporter>

Creates a new PrometheusExporter from this configuration.

Trait Implementations§

source§

impl Debug for ExporterBuilder

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for ExporterBuilder

source§

fn default() -> ExporterBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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> FutureExt for T

source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T, U> Into<U> for T
where 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, U> TryFrom<U> for T
where 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 T
where 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.