Struct opentelemetry_sdk::metrics::PeriodicReaderBuilder
source · pub struct PeriodicReaderBuilder<E, RT> { /* private fields */ }
Expand description
Configuration options for PeriodicReader.
A periodic reader is a MetricReader that collects and exports metric data to the exporter at a defined interval.
By default, the returned MetricReader will collect and export data every 60 seconds, and will cancel export attempts that exceed 30 seconds. The export time is not counted towards the interval between attempts.
The collect method of the returned MetricReader continues to gather and return metric data to the user. It will not automatically send that data to the exporter outside of the predefined interval.
Implementations§
source§impl<E, RT> PeriodicReaderBuilder<E, RT>where
E: PushMetricsExporter,
RT: Runtime,
impl<E, RT> PeriodicReaderBuilder<E, RT>where
E: PushMetricsExporter,
RT: Runtime,
sourcepub fn with_interval(self, interval: Duration) -> Self
pub fn with_interval(self, interval: Duration) -> Self
Configures the intervening time between exports for a PeriodicReader.
This option overrides any value set for the OTEL_METRIC_EXPORT_INTERVAL
environment variable.
If this option is not used or interval
is equal to zero, 60 seconds is
used as the default.
sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Configures the time a PeriodicReader waits for an export to complete before canceling it.
This option overrides any value set for the OTEL_METRIC_EXPORT_TIMEOUT
environment variable.
If this option is not used or timeout
is equal to zero, 30 seconds is used
as the default.
sourcepub fn with_producer(self, producer: impl MetricProducer + 'static) -> Self
pub fn with_producer(self, producer: impl MetricProducer + 'static) -> Self
Registers a 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.
sourcepub fn build(self) -> PeriodicReader
pub fn build(self) -> PeriodicReader
Create a PeriodicReader with the given config.