pub struct UsageMeter { /* private fields */ }Expand description
The live, thread-safe counters of one run. Cheap to share (Arc).
Implementations§
Source§impl UsageMeter
impl UsageMeter
pub fn new() -> Self
Sourcepub fn add_written(&self, records: u64, bytes: u64)
pub fn add_written(&self, records: u64, bytes: u64)
Count a page the sink accepted.
Sourcepub fn add_roundtrip(&self, side: UsageSide, op: &'static str)
pub fn add_roundtrip(&self, side: UsageSide, op: &'static str)
Count one backend round trip.
Sourcepub fn add_signal(&self, signal: CostSignal)
pub fn add_signal(&self, signal: CostSignal)
Record a backend-reported usage figure.
Sourcepub fn add_throttled(&self)
pub fn add_throttled(&self)
Count one rate-limit response the source received.
Sourcepub fn add_throttle_wait(&self, slept: Duration)
pub fn add_throttle_wait(&self, slept: Duration)
Add time the source actually slept on a rate limit.
Sourcepub fn add_source_retry(&self, class: &'static str)
pub fn add_source_retry(&self, class: &'static str)
Count one source-side retry of class.
Sourcepub fn records_written(&self) -> u64
pub fn records_written(&self) -> u64
Records the sink accepted so far (what a max_records budget checks).
Sourcepub fn bytes_written(&self) -> u64
pub fn bytes_written(&self) -> u64
Estimated bytes the sink accepted so far (what a max_bytes budget
checks).
Sourcepub fn snapshot(&self) -> UsageSnapshot
pub fn snapshot(&self) -> UsageSnapshot
Freeze the counters.
Trait Implementations§
Source§impl Debug for UsageMeter
impl Debug for UsageMeter
Auto Trait Implementations§
impl !Freeze for UsageMeter
impl RefUnwindSafe for UsageMeter
impl Send for UsageMeter
impl Sync for UsageMeter
impl Unpin for UsageMeter
impl UnsafeUnpin for UsageMeter
impl UnwindSafe for UsageMeter
Blanket Implementations§
impl<T> Allocation for T
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
Mutably borrows from an owned value. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> ⓘ
Converts
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> ⓘ
Converts
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request