pub struct TrafficStats {Show 13 fields
pub duration_s: f64,
pub num_req: usize,
pub avg_isl: f64,
pub avg_osl: f64,
pub avg_ttft_ms: f64,
pub avg_itl_ms: f64,
pub shape_count: usize,
pub ttft_count: usize,
pub itl_count: usize,
pub avg_accept_length: Option<f64>,
pub avg_kv_hit_rate: f64,
pub hit_rate_count: usize,
pub accept_length_forward_count: usize,
}Expand description
Accumulated traffic statistics returned by [TrafficAccumulator::drain].
IMPORTANT: When fields here are added or renamed, update the PyO3
binding in lib/bindings/python/rust/llm/replay.rs (drain_traffic
method) so the exported JSON dict matches. The Python adapter in
replay_adapter.py reads these keys by name.
Fields§
§duration_s: f64§num_req: usizeRequests offered to the replay runtime during the window. This matches
the live planner’s requests_started_total demand signal.
avg_isl: f64§avg_osl: f64§avg_ttft_ms: f64§avg_itl_ms: f64§shape_count: usizeCompleted, non-rejected requests behind avg_isl and avg_osl.
ttft_count: usizeCompleted requests behind avg_ttft_ms.
itl_count: usizeCompleted requests behind avg_itl_ms.
avg_accept_length: Option<f64>Mean visible tokens produced per decode request-forward, including the
base token. None means the window had no decode forwards.
avg_kv_hit_rate: f64Mean prefix-cache hit rate (0.0-1.0) across router admissions in
the window, computed as mean(overlap_blocks / isl_blocks) over
admitted requests (i.e. the arithmetic mean of per-request
ratios). Matches the semantics of the real router’s
dynamo_component_router_kv_hit_rate Prometheus histogram,
which observes one overlap/isl sample per request; the
PromQL query sum(increase(_sum)) / sum(increase(_count))
returns the arithmetic mean of those samples, independent of
per-request ISL size.
hit_rate_count: usizeNumber of samples behind avg_kv_hit_rate (its denominator: router
admissions with isl_blocks > 0). Carried so a consumer that merges
several drained windows can reconstruct the exact sample-weighted mean
rather than approximating it with num_req.
accept_length_forward_count: usizeNumber of decode request-forwards behind avg_accept_length (its
denominator). Same purpose as hit_rate_count for cross-window merges.
Trait Implementations§
Source§impl Clone for TrafficStats
impl Clone for TrafficStats
Source§fn clone(&self) -> TrafficStats
fn clone(&self) -> TrafficStats
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more