pub struct RoundtripRecorder { /* private fields */ }Expand description
A pre-labelled handle a connector uses to count its own backend calls.
Cheap to clone (the label vec is built once at construction and cloned per
call, exactly like the decorators’ base_labels). Held behind an
Arc/OnceLock by connectors that opt in; a connector that never calls
record emits nothing at all, so instrumentation can land
connector by connector without any behaviour change in between.
Implementations§
Source§impl RoundtripRecorder
impl RoundtripRecorder
Sourcepub fn new(
side: RoundtripSide,
pipeline: impl Into<SharedString>,
row: impl Into<SharedString>,
connector: impl Into<SharedString>,
) -> Self
pub fn new( side: RoundtripSide, pipeline: impl Into<SharedString>, row: impl Into<SharedString>, connector: impl Into<SharedString>, ) -> Self
Build a recorder for one connector instance.
Sourcepub fn throttle_tally(&self) -> Arc<ThrottleTally> ⓘ
pub fn throttle_tally(&self) -> Arc<ThrottleTally> ⓘ
The rate-limit totals this recorder has observed so far.
Sourcepub fn throttled(&self)
pub fn throttled(&self)
Count one rate-limit response (HTTP 429, a RateLimited error, a
backend’s throttling code) — every one received, whether or not it is
retried. Emits faucet_source_throttled_total.
Sourcepub fn throttle_wait(&self, slept: Duration)
pub fn throttle_wait(&self, slept: Duration)
Record time actually slept because of a rate limit. Pass the measured
sleep, never the server’s Retry-After value; ThrottleWait measures
it for you, including a sleep cut short by cancellation.
Sourcepub fn retry(&self, class: RetryClass)
pub fn retry(&self, class: RetryClass)
Count one retry the connector is about to make, by class. Emits
faucet_source_retries_total{class}.
Sourcepub fn with_meter(self, meter: Arc<UsageMeter>) -> Self
pub fn with_meter(self, meter: Arc<UsageMeter>) -> Self
Also tally into a run’s usage meter (#704).
Sourcepub fn signal(&self, kind: &'static str, unit: &'static str, quantity: f64)
pub fn signal(&self, kind: &'static str, unit: &'static str, quantity: f64)
Report a backend-measured usage figure (#704) — BigQuery’s bytes
billed for a job, the payload size of a streaming insert, a
warehouse’s credits. Emitted as
faucet_cost_signals_total{pipeline,row,connector,kind,unit} (the
quantity rounded to a whole unit) and, when a meter is attached, kept
verbatim for the run’s usage record. kind and unit are a closed
set per connector, documented in its README.
Sourcepub fn record(&self, op: &'static str)
pub fn record(&self, op: &'static str)
Count one round trip to the backend.
op must come from the connector’s own closed set — never a URL,
query, status code, or host, which would make the series unbounded.
A retried call is a real round trip and must be counted again.
Sourcepub fn replication_key_missing(&self, n: u64)
pub fn replication_key_missing(&self, n: u64)
Count records whose incremental replication key was missing or null
(#747). Emits faucet_source_replication_key_missing_total.
Sourcepub fn record_timed(&self, op: &'static str, elapsed: Duration)
pub fn record_timed(&self, op: &'static str, elapsed: Duration)
Count one round trip and record how long it took.
Trait Implementations§
Source§impl Clone for RoundtripRecorder
impl Clone for RoundtripRecorder
Auto Trait Implementations§
impl Freeze for RoundtripRecorder
impl RefUnwindSafe for RoundtripRecorder
impl Send for RoundtripRecorder
impl Sync for RoundtripRecorder
impl Unpin for RoundtripRecorder
impl UnsafeUnpin for RoundtripRecorder
impl UnwindSafe for RoundtripRecorder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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 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>
T in a tonic::Request