pub struct InferenceTraceAttempt { /* private fields */ }Expand description
No-op-capable handle for recording one upstream inference attempt. One concrete upstream request attempt.
A Codex turn can create multiple attempts when auth recovery retries the HTTP request or WebSocket setup falls back to HTTP. Completion is often observed after the client returns the response stream, so the attempt owns the terminal guard that prevents duplicate lifecycle events.
Implementations§
Source§impl InferenceTraceAttempt
impl InferenceTraceAttempt
Sourcepub fn add_request_headers(&self, headers: &mut HeaderMap)
pub fn add_request_headers(&self, headers: &mut HeaderMap)
Adds rollout-trace propagation headers for this attempt when tracing is enabled.
Sourcepub fn record_started(&self, request: &impl Serialize)
pub fn record_started(&self, request: &impl Serialize)
Records the request payload replay should treat as the model-visible inference input.
This is usually the exact provider request. Callers may instead pass a logical request when the transport omits already-sent input, such as websocket reuse after an untraced warmup response.
Sourcepub fn record_completed(
&self,
response_id: &str,
upstream_request_id: Option<&str>,
token_usage: &Option<TokenUsage>,
output_items: &[ResponseItem],
)
pub fn record_completed( &self, response_id: &str, upstream_request_id: Option<&str>, token_usage: &Option<TokenUsage>, output_items: &[ResponseItem], )
Records successful provider completion and serializes the observed output items.
Callers pass protocol-native response items so this crate owns the trace-specific serialization rules. That keeps codex-core focused on transport behavior while preserving trace evidence that normal request serialization intentionally omits.
Sourcepub fn record_failed(
&self,
error: impl Display,
upstream_request_id: Option<&str>,
output_items: &[ResponseItem],
)
pub fn record_failed( &self, error: impl Display, upstream_request_id: Option<&str>, output_items: &[ResponseItem], )
Records pre-response and mid-stream failures.
Sourcepub fn record_cancelled(
&self,
reason: impl Display,
upstream_request_id: Option<&str>,
output_items: &[ResponseItem],
)
pub fn record_cancelled( &self, reason: impl Display, upstream_request_id: Option<&str>, output_items: &[ResponseItem], )
Records a provider stream that Codex intentionally stopped consuming.
This happens when the turn is interrupted or when mailbox delivery preempts the current sampling request. Complete output items observed before that point are retained as partial response evidence.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for InferenceTraceAttempt
impl RefUnwindSafe for InferenceTraceAttempt
impl Send for InferenceTraceAttempt
impl Sync for InferenceTraceAttempt
impl Unpin for InferenceTraceAttempt
impl UnsafeUnpin for InferenceTraceAttempt
impl UnwindSafe for InferenceTraceAttempt
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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 more