Skip to main content

MeterEventExporter

Struct MeterEventExporter 

Source
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>

Source

pub fn new(provider: P) -> Self

Construct an exporter with a dead letter capacity of 1,024.

Source

pub const fn provider(&self) -> &P

Access the provider for diagnostics and tests.

Source

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.

Source

pub fn dead_letter_count(&self) -> usize

Number of aggregates retained for reconciliation.

Source

pub fn dropped_dead_letters(&self) -> u64

Number of reconciliation aggregates discarded because retention was full.

Source

pub fn take_dead_letters(&self) -> Vec<MeterEventDeadLetter>

Drain retained aggregates for application-owned reconciliation.

Source

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.

Source

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.

Source

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>

Source§

fn export<'a>(&'a self, batch: &'a [AggregatedUsage]) -> ExportFuture<'a>

Export every aggregate in batch. Read more
Source§

impl<P> Debug for MeterEventExporter<P>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more