#[non_exhaustive]pub struct LroRecorder { /* private fields */ }Expand description
A recorder that manages LRO spans and propagates active telemetry context.
To prevent concurrent mutation race conditions under multi-threaded tokio executors,
LroRecorder is largely immutable. Context updates (like setting the transient attempt_count
during a polling cycle) are performed using copy-on-write builders (with_attempt_count)
to establish new task-local scopes.
The destination_id is an exception: it is a write-once, read-many value shared across
all clones of a given recorder, ensuring that once discovered, the ID propagates to all
future polling spans.
Implementations§
Source§impl LroRecorder
impl LroRecorder
Sourcepub async fn scope<F, T>(&self, future: F) -> Twhere
F: Future<Output = T>,
pub async fn scope<F, T>(&self, future: F) -> Twhere
F: Future<Output = T>,
Runs a future within the scope of this recorder.
Sourcepub fn attempt_count(&self) -> Option<u32>
pub fn attempt_count(&self) -> Option<u32>
Returns the current LRO polling attempt count, if active.
This returns Some(u32) when queried during an active polling attempt,
and None otherwise (e.g., when executing outside the scope of an active polling cycle).
Source§impl LroRecorder
impl LroRecorder
Sourcepub fn with_attempt_count(&self, count: u32) -> Self
pub fn with_attempt_count(&self, count: u32) -> Self
Creates a new clone of LroRecorder carrying the specified LRO polling attempt count.
Since LroRecorder is immutable to guarantee thread-safety, this updates the context
via copy-on-write, returning a new value to be bound to a new task-local scope.
pub fn record_destination_id(&self, name: &str)
pub fn destination_id(&self) -> Option<String>
pub fn record_error(&self, err: &Error)
pub async fn record_action<F, Fut, T>(&self, f: F) -> T
Trait Implementations§
Source§impl Clone for LroRecorder
impl Clone for LroRecorder
Source§fn clone(&self) -> LroRecorder
fn clone(&self) -> LroRecorder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for LroRecorder
impl !UnwindSafe for LroRecorder
impl Freeze for LroRecorder
impl Send for LroRecorder
impl Sync for LroRecorder
impl Unpin for LroRecorder
impl UnsafeUnpin for LroRecorder
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> 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> 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