Trait PushMetricExporter

pub trait PushMetricExporter:
    Send
    + Sync
    + 'static {
    // Required methods
    fn export(
        &self,
        metrics: &ResourceMetrics,
    ) -> impl Future<Output = Result<(), OTelSdkError>> + Send;
    fn force_flush(&self) -> Result<(), OTelSdkError>;
    fn shutdown_with_timeout(
        &self,
        timeout: Duration,
    ) -> Result<(), OTelSdkError>;
    fn temporality(&self) -> Temporality;

    // Provided method
    fn shutdown(&self) -> Result<(), OTelSdkError> { ... }
}
Expand description

Exporter handles the delivery of metric data to external receivers.

This is the final component in the metric push pipeline.

Required Methods§

fn export( &self, metrics: &ResourceMetrics, ) -> impl Future<Output = Result<(), OTelSdkError>> + Send

Export serializes and transmits metric data to a receiver.

All retry logic must be contained in this function. The SDK does not implement any retry logic. All errors returned by this function are considered unrecoverable and will be logged.

fn force_flush(&self) -> Result<(), OTelSdkError>

Flushes any metric data held by an exporter.

fn shutdown_with_timeout(&self, timeout: Duration) -> Result<(), OTelSdkError>

Releases any held computational resources.

After Shutdown is called, calls to Export will perform no operation and instead will return an error indicating the shutdown state.

fn temporality(&self) -> Temporality

Access the Temporality of the MetricExporter.

Provided Methods§

fn shutdown(&self) -> Result<(), OTelSdkError>

Shutdown with the default timeout of 5 seconds.

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.

Implementors§