pub struct MeterEventExporter<P> { /* private fields */ }Expand description
Exports pre-aggregated usage through an application-supplied provider.
Confirmed accepted and permanently rejected events are skipped on a later retry. Retryable and ambiguous events retain their original identifiers. While partial progress exists, only the identical original batch is accepted.
Implementations§
Source§impl<P> MeterEventExporter<P>
impl<P> MeterEventExporter<P>
Sourcepub fn with_dead_letter_capacity(self, capacity: usize) -> Self
pub fn with_dead_letter_capacity(self, capacity: usize) -> Self
Bound how many rejected aggregates are retained for reconciliation.
Reducing the capacity evicts the oldest entries and increments
MeterEventExporter::dropped_dead_letters. Zero disables retention
while continuing to count discarded entries.
Sourcepub fn dead_letter_count(&self) -> usize
pub fn dead_letter_count(&self) -> usize
Number of aggregates retained for reconciliation.
Sourcepub fn dropped_dead_letters(&self) -> u64
pub fn dropped_dead_letters(&self) -> u64
Number of reconciliation aggregates discarded because retention was full.
Sourcepub fn take_dead_letters(&self) -> Vec<MeterEventDeadLetter>
pub fn take_dead_letters(&self) -> Vec<MeterEventDeadLetter>
Drain retained aggregates for application-owned reconciliation.
Sourcepub fn quarantine_async_rejection(
&self,
aggregate: &AggregatedUsage,
code: &'static str,
) -> bool
pub fn quarantine_async_rejection( &self, aggregate: &AggregatedUsage, code: &'static str, ) -> bool
Retain an aggregate that a provider rejected after initial acceptance.
Returns true when the aggregate was newly retained. A duplicate
identifier or zero-capacity queue returns false. The code must be a
static, sanitized, low-cardinality category.
Sourcepub fn retry_in_progress(&self) -> bool
pub fn retry_in_progress(&self) -> bool
Whether an incomplete batch is still owed a retry.
While this is true, BatchExporter::export accepts only the identical
original batch and refuses any other.
Sourcepub fn abandon_retry_progress(&self) -> Vec<String>
pub fn abandon_retry_progress(&self) -> Vec<String>
Give up on an incomplete batch so a different one can be exported.
Returns the identifiers that were not confirmed complete. If an export is
currently running, no progress is abandoned and an empty vector is
returned. Callers can distinguish that case with Self::retry_in_progress.
Trait Implementations§
Source§impl<P: MeterEventProvider> BatchExporter for MeterEventExporter<P>
impl<P: MeterEventProvider> BatchExporter for MeterEventExporter<P>
Source§fn export<'a>(&'a self, batch: &'a [AggregatedUsage]) -> ExportFuture<'a>
fn export<'a>(&'a self, batch: &'a [AggregatedUsage]) -> ExportFuture<'a>
batch. Read more