pub struct RequestTracer { /* private fields */ }Expand description
Builds and emits one record per actual transport attempt (see module docs for the record rule). Owned by a single request; not shared.
Implementations§
Source§impl RequestTracer
impl RequestTracer
Sourcepub fn begin(
ctx: &TraceContext,
correlation: Option<RequestCorrelation>,
model: QualifiedModelId,
transport: TransportKind,
endpoint: EndpointMeta,
structure: RequestStructure,
) -> Option<Self>
pub fn begin( ctx: &TraceContext, correlation: Option<RequestCorrelation>, model: QualifiedModelId, transport: TransportKind, endpoint: EndpointMeta, structure: RequestStructure, ) -> Option<Self>
Begin tracing one request. Returns None when the context is
disabled or the structural identity is unrepresentable (counted as a
degraded record — never an error).
Sourcepub fn request_id(&self) -> &TraceId
pub fn request_id(&self) -> &TraceId
The shared request ID for correlating this request’s records.
pub fn correlation_ids(&self) -> (&TraceId, &TraceId, &TraceId)
Sourcepub fn attempt_failed(
&mut self,
clock: AttemptClock,
class: RetryClass,
delay: Duration,
http_status: Option<u16>,
provider_request_id: Option<TraceId>,
code: &str,
)
pub fn attempt_failed( &mut self, clock: AttemptClock, class: RetryClass, delay: Duration, http_status: Option<u16>, provider_request_id: Option<TraceId>, code: &str, )
Record a failed attempt that WILL be retried: emits this attempt’s
record (typed ProviderFailed terminal), then appends the retry to
the shared history and advances the attempt ordinal.
Sourcepub fn finish(
self,
clock: AttemptClock,
http_status: Option<u16>,
provider_request_id: Option<TraceId>,
stop_reason: Option<StopReason>,
usage: Option<UsageMeta>,
terminal: TurnOutcome,
)
pub fn finish( self, clock: AttemptClock, http_status: Option<u16>, provider_request_id: Option<TraceId>, stop_reason: Option<StopReason>, usage: Option<UsageMeta>, terminal: TurnOutcome, )
Emit the final record for this request’s last attempt.
Sourcepub fn failed_terminal(&self, code: &str) -> TurnOutcome
pub fn failed_terminal(&self, code: &str) -> TurnOutcome
A typed terminal for an attempt that failed: the correlation ID is the trace request ID — never a raw error string.
Auto Trait Implementations§
impl !RefUnwindSafe for RequestTracer
impl !UnwindSafe for RequestTracer
impl Freeze for RequestTracer
impl Send for RequestTracer
impl Sync for RequestTracer
impl Unpin for RequestTracer
impl UnsafeUnpin for RequestTracer
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
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.