pub struct WireContext {
pub provider: String,
pub person: Option<String>,
pub team: Option<String>,
pub project: Option<String>,
pub saved_tokens: u64,
pub uncompressed_input_tokens: u64,
pub is_local: bool,
pub routed_from: Option<String>,
pub counterfactual: Option<CounterfactualSlot>,
pub lineage: Option<OclaRequestContext>,
}Expand description
Request-side context the forward path knows and the response scanner does
not: who sent the request (gateway identity, enterprise#11), what the proxy
saved on the wire, and the counterfactual-baseline inputs (enterprise#18).
Travels inside RealUsage so usage_meter::record stays the single
choke-point through which every measured turn flows.
Fields§
§provider: StringProvider label (Anthropic|OpenAI|ChatGPT|Gemini) of the serving route.
person: Option<String>Person tag from the gateway key (enterprise#11).
team: Option<String>Team tag from the gateway key.
project: Option<String>Project: x-leanctx-project header wins over the key’s default project.
saved_tokens: u64Estimated tokens this request saved through wire compression (bytes/4 heuristic, same basis as the proxy stats).
uncompressed_input_tokens: u64Estimated request tokens BEFORE lean-ctx compression (bytes/4) — the SEE-attribution input of the avoided-cost baseline (enterprise#18).
is_local: boolTrue when the serving upstream is a local/loopback endpoint — billed via
the transparent local_shadow_rate, never 0 (enterprise#15/#18).
routed_from: Option<String>Originally requested model when the router downgraded/aliased it
(enterprise#13); None for passthrough.
counterfactual: Option<CounterfactualSlot>Provider-counted input tokens of the ORIGINAL (uncompressed) request,
from the free count_tokens probe (#701). None when metering is off
or no probe was spawned; an empty slot at read time (probe failed or
still in flight) degrades the row to the local estimate.
lineage: Option<OclaRequestContext>Complete, validated OCLA lineage for managed HTTP requests. None keeps
legacy, malformed and non-HTTP traffic explicitly unmanaged.
Implementations§
Source§impl WireContext
impl WireContext
pub fn ocla_request_context(&self) -> Option<&OclaRequestContext>
Trait Implementations§
Source§impl Clone for WireContext
impl Clone for WireContext
Source§fn clone(&self) -> WireContext
fn clone(&self) -> WireContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WireContext
impl Debug for WireContext
Source§impl Default for WireContext
impl Default for WireContext
Source§fn default() -> WireContext
fn default() -> WireContext
Source§impl PartialEq for WireContext
impl PartialEq for WireContext
impl StructuralPartialEq for WireContext
Auto Trait Implementations§
impl Freeze for WireContext
impl RefUnwindSafe for WireContext
impl Send for WireContext
impl Sync for WireContext
impl Unpin for WireContext
impl UnsafeUnpin for WireContext
impl UnwindSafe for WireContext
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,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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