Skip to main content

UsageExporter

Trait UsageExporter 

Source
pub trait UsageExporter: Send + Sync {
    // Required methods
    fn export<'life0, 'life1, 'async_trait>(
        &'life0 self,
        summary: &'life1 Value,
    ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn shutdown<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Push-style usage exporter (#45 §3).

Implementations forward periodic JSON snapshots of usage stats to an external sink (HTTP collector, OpenTelemetry exporter, custom stdout formatter, …). The summary payload mirrors the JSON shape produced by serde_json::to_value(&UsageCollector::get_all_summaries()).

Required Methods§

Source

fn export<'life0, 'life1, 'async_trait>( &'life0 self, summary: &'life1 Value, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Export a single summary snapshot. Errors are surfaced to callers but MUST NOT terminate the periodic driver.

Source

fn shutdown<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Flush any buffered state and release resources. Called once during PeriodicUsageExporter::stop().

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§