Skip to main content

TelemetryOutageQueue

Struct TelemetryOutageQueue 

Source
pub struct TelemetryOutageQueue<T> { /* private fields */ }
Expand description

A count-and-byte bounded queue for exporter adapters.

This type does not create a task or thread. The exporter remains owned by the service’s existing lifecycle and calls Self::drain_batch from that owned worker.

Implementations§

Source§

impl<T> TelemetryOutageQueue<T>

Source

pub fn new(limits: TelemetryQueueLimits) -> Self

Creates an empty queue with validated limits.

Source

pub fn try_enqueue( &self, item: T, estimated_bytes: usize, ) -> TelemetryEnqueueOutcome

Attempts to admit a telemetry record without waiting for an exporter lock.

estimated_bytes must include the envelope and attribute payload estimate used by the owning exporter. A zero estimate is accounted as one byte so the byte budget always moves.

Source

pub fn drain_batch(&self, max_items: usize, max_bytes: usize) -> Vec<T>

Removes a bounded FIFO batch for an exporter worker.

max_items and max_bytes are clamped to at least one. One admitted record may exceed max_bytes; it is still returned alone so a worker can always make progress.

Source

pub fn begin_shutdown(&self, deadline: Instant)

Stops new admission and binds shutdown to one absolute deadline.

Source

pub fn poll_shutdown( &self, now: Instant, ) -> Option<TelemetryOutageShutdownReport>

Returns a final report once the queue drains or the absolute deadline expires.

Before the deadline, None means the exporter worker should continue draining. At the deadline, all remaining records are dropped and included in the report.

Source

pub fn snapshot(&self) -> TelemetryQueueSnapshot

Returns current queue occupancy and lifetime counters.

Trait Implementations§

Source§

impl<T> Debug for TelemetryOutageQueue<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T> Default for TelemetryOutageQueue<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T> !Freeze for TelemetryOutageQueue<T>

§

impl<T> !RefUnwindSafe for TelemetryOutageQueue<T>

§

impl<T> !UnwindSafe for TelemetryOutageQueue<T>

§

impl<T> Send for TelemetryOutageQueue<T>
where BudgetedQueue<Queued<T>>: Send, Mutex<Option<BudgetedItem<Queued<T>>>>: Send,

§

impl<T> Sync for TelemetryOutageQueue<T>
where BudgetedQueue<Queued<T>>: Sync, Mutex<Option<BudgetedItem<Queued<T>>>>: Sync,

§

impl<T> Unpin for TelemetryOutageQueue<T>
where BudgetedQueue<Queued<T>>: Unpin, Mutex<Option<BudgetedItem<Queued<T>>>>: Unpin,

§

impl<T> UnsafeUnpin for TelemetryOutageQueue<T>
where BudgetedQueue<Queued<T>>: UnsafeUnpin, Mutex<Option<BudgetedItem<Queued<T>>>>: UnsafeUnpin,

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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