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 new(provider: P) -> MeterEventExporter<P>
pub fn new(provider: P) -> MeterEventExporter<P>
Construct an exporter with a dead letter capacity of 1,024.
Sourcepub fn with_dead_letter_capacity(self, capacity: usize) -> MeterEventExporter<P>
pub fn with_dead_letter_capacity(self, capacity: usize) -> MeterEventExporter<P>
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> BatchExporter for MeterEventExporter<P>where
P: MeterEventProvider,
impl<P> BatchExporter for MeterEventExporter<P>where
P: MeterEventProvider,
Source§fn retry_policy(&self) -> RetryPolicy
fn retry_policy(&self) -> RetryPolicy
Auto Trait Implementations§
impl<P> !Freeze for MeterEventExporter<P>
impl<P> RefUnwindSafe for MeterEventExporter<P>where
P: RefUnwindSafe,
impl<P> Send for MeterEventExporter<P>where
P: Send,
impl<P> Sync for MeterEventExporter<P>where
P: Sync,
impl<P> Unpin for MeterEventExporter<P>where
P: Unpin,
impl<P> UnsafeUnpin for MeterEventExporter<P>where
P: UnsafeUnpin,
impl<P> UnwindSafe for MeterEventExporter<P>where
P: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more