Struct opentelemetry_sdk::metrics::PeriodicReader
source · pub struct PeriodicReader { /* private fields */ }
Expand description
A MetricReader that continuously collects and exports metric data at a set interval.
By default it 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 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.
The runtime can be selected based on feature flags set for this crate.
The exporter can be any exporter that implements PushMetricsExporter such as opentelemetry-otlp.
§Example
use opentelemetry_sdk::metrics::PeriodicReader;
let exporter = get_exporter(); // set up a push exporter like OTLP
let runtime = get_runtime(); // select runtime: e.g. opentelemetry_sdk:runtime::Tokio
let reader = PeriodicReader::builder(exporter, runtime).build();
Implementations§
source§impl PeriodicReader
impl PeriodicReader
sourcepub fn builder<E, RT>(exporter: E, runtime: RT) -> PeriodicReaderBuilder<E, RT>where
E: PushMetricsExporter,
RT: Runtime,
pub fn builder<E, RT>(exporter: E, runtime: RT) -> PeriodicReaderBuilder<E, RT>where
E: PushMetricsExporter,
RT: Runtime,
Configuration options for a periodic reader
Trait Implementations§
source§impl AggregationSelector for PeriodicReader
impl AggregationSelector for PeriodicReader
source§fn aggregation(&self, kind: InstrumentKind) -> Aggregation
fn aggregation(&self, kind: InstrumentKind) -> Aggregation
Selects the aggregation and the parameters to use for that aggregation based on
the InstrumentKind.
source§impl Clone for PeriodicReader
impl Clone for PeriodicReader
source§fn clone(&self) -> PeriodicReader
fn clone(&self) -> PeriodicReader
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for PeriodicReader
impl Debug for PeriodicReader
source§impl MetricReader for PeriodicReader
impl MetricReader for PeriodicReader
source§fn register_pipeline(&self, pipeline: Weak<Pipeline>)
fn register_pipeline(&self, pipeline: Weak<Pipeline>)
Registers a MetricReader with a [Pipeline]. Read more
source§fn collect(&self, rm: &mut ResourceMetrics) -> Result<()>
fn collect(&self, rm: &mut ResourceMetrics) -> Result<()>
Gathers and returns all metric data related to the MetricReader from the
SDK and stores it in the provided ResourceMetrics reference. Read more
source§impl TemporalitySelector for PeriodicReader
impl TemporalitySelector for PeriodicReader
source§fn temporality(&self, kind: InstrumentKind) -> Temporality
fn temporality(&self, kind: InstrumentKind) -> Temporality
Selects the temporality to use based on the InstrumentKind.
Auto Trait Implementations§
impl Freeze for PeriodicReader
impl !RefUnwindSafe for PeriodicReader
impl Send for PeriodicReader
impl Sync for PeriodicReader
impl Unpin for PeriodicReader
impl !UnwindSafe for PeriodicReader
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)