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 PushMetricExporter 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: PushMetricExporter,
RT: Runtime,
pub fn builder<E, RT>(exporter: E, runtime: RT) -> PeriodicReaderBuilder<E, RT>where
E: PushMetricExporter,
RT: Runtime,
Configuration options for a periodic reader
Trait Implementations§
source§impl Clone for PeriodicReader
impl Clone for PeriodicReader
source§fn clone(&self) -> PeriodicReader
fn clone(&self) -> PeriodicReader
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PeriodicReader
impl Debug for PeriodicReader
source§impl MetricReader for PeriodicReader
impl MetricReader for PeriodicReader
source§fn temporality(&self, kind: InstrumentKind) -> Temporality
fn temporality(&self, kind: InstrumentKind) -> Temporality
To construct a MetricReader when setting up an SDK, The output temporality (optional), a function of instrument kind. This function SHOULD be obtained from the exporter.
If not configured, the Cumulative temporality SHOULD be used.
source§fn register_pipeline(&self, pipeline: Weak<Pipeline>)
fn register_pipeline(&self, pipeline: Weak<Pipeline>)
source§fn collect(&self, rm: &mut ResourceMetrics) -> MetricResult<()>
fn collect(&self, rm: &mut ResourceMetrics) -> MetricResult<()>
source§fn force_flush(&self) -> MetricResult<()>
fn force_flush(&self) -> MetricResult<()>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)