pub struct Record {Show 15 fields
pub request_id: String,
pub ts: String,
pub tenant_id: String,
pub model: Model,
pub route: String,
pub input: StreamDelta,
pub output: StreamDelta,
pub thinking: Option<StreamDelta>,
pub cost: CostEntry,
pub integrity: Integrity,
pub dialect: Option<String>,
pub rules_applied: Option<Vec<String>>,
pub rule_fire_counts: Option<Vec<(String, u32)>>,
pub quality: Option<QualityScore>,
pub bytes_saved_by_rule: Option<Vec<(String, u64)>>,
}Expand description
A single signed measurement record. Wire format frozen at v0.1.
§Changelog
- v0.0.2: Added
dialectandrules_appliedas backward-compatible#[serde(default)]optional fields. Both default toNonefor v0.1 readers. Phase-2 Agent D’s encoder populates them. - v0.0.4: Added
bytes_saved_by_ruleas backward-compatible#[serde(default)]optional field.Nonefor v0.0.3-and-earlier readers. Wired by Step 9 ofdocs/PLAN_2026-04-24.md— schema lands now so future encoder instrumentation (per-rule byte-delta callbacks) can populate without a second migration. Until then the field is alwaysNoneat produce time. Consumers must handleNonegracefully (treat as “no attribution available”).
Fields§
§request_id: StringULID request identifier.
ts: StringISO-8601 timestamp with millisecond precision.
tenant_id: StringTenant id. Required for multi-tenant reporting.
model: ModelModel the request was routed to.
route: StringRoute classification (agent-to-agent, agent-to-human, etc).
input: StreamDeltaInput-stream measurement (baseline vs compressed).
output: StreamDeltaOutput-stream measurement.
thinking: Option<StreamDelta>Thinking-stream measurement (when provider exposes it).
cost: CostEntryCost translation at capture time.
integrity: IntegrityCryptographic integrity fields.
dialect: Option<String>Pithy dialect family used for compression (e.g. "ultracos-symbolic-v1").
Added in v0.0.2. Populated by Phase-2 encoder; None for v0.1 records.
rules_applied: Option<Vec<String>>Ordered list of compression rules applied during encoding.
Added in v0.0.2. Populated by Phase-2 encoder; None for v0.1 records.
rule_fire_counts: Option<Vec<(String, u32)>>Per-rule firing counts (alphabetical by rule name).
Added in v0.0.3. Populated by EncoderTrace::as_pairs so the
post-hoc analyzer can attribute savings and quality regressions
to specific rules without re-running the encoder. None when
the encoder did not run (Prose fallback) or the producer is on
the v0.0.2 wire schema.
quality: Option<QualityScore>Optional shadow-arm quality measurement. Set when the proxy ran the same prompt through both the compressed and the prose arm at sample rate, so the closed-loop tuner can correlate compression with response quality. Added in v0.0.3.
bytes_saved_by_rule: Option<Vec<(String, u64)>>Per-rule byte-savings attribution, in UTF-8 bytes of input payload.
Added in v0.0.4 as the substrate for PLAN Step 9. Aggregate
delta_tokens + rule_fire_counts tells us WHICH rules fired
and HOW OFTEN, but not WHICH BYTES each rule removed from the
payload. Step 8+ rule-vs-rule tuning needs the latter.
Populated by the encoder once per-rule byte-delta callbacks are
wired (separate follow-up commit). Until then, this field is
None at produce time and consumers MUST treat None as “no
attribution available”, not as “zero savings”.
Units are bytes of input before vs after the rule ran, not tokens. The bandit converts to token-equivalents against the target-model tokenizer at aggregation time, so this field stays tokenizer-agnostic and doesn’t drift when tokenizer choices change (see B8 DeepSeek-V4 addition).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Record
impl<'de> Deserialize<'de> for Record
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Record
impl RefUnwindSafe for Record
impl Send for Record
impl Sync for Record
impl Unpin for Record
impl UnsafeUnpin for Record
impl UnwindSafe for Record
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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