Repository navigation
telemetry: clock rule, every terminal path, real cache hits, schema + drop counts - #102
Merged
Merged
Conversation
…ma + drop counts - arrival_ts is epoch seconds back-dated from one perf_counter stamp taken at HTTP receipt; ttft_s/total_s run from receipt, all durations stay on perf_counter. - ttft_s only when a real token was emitted (EOS-first has none); tpot = (E2E - TTFT)/(n - 1); decode_steps counts forward passes. - New terminal states: cancelled (stream client went away, or submit cancelled; the row is evicted / never admitted) and aborted (engine stopped with the request queued or in flight). A wedged worker now also fails pending requests instead of leaving them waiting. - Batched prefill reports per-row prefix-cache hits from the backend instead of a hardcoded 0; rows carry prefill_mode, and cache_hit_tokens is NULL when no lookup was reported. - Rows carry schema_version; the SQLite file gets a meta table (schema_version, run_id, rows_written, rows_dropped, closed). Rows put after close count as dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review of the per-request telemetry rows against the environment's request-trace contract (BlameGraph
lab/TRACE.md).Fixed
arrival_tswas a separatetime.time()read taken inside the pending lock, afterenqueue_ts. It's now derived from one perf_counter stamp (ScheduledRequest.arrival_ts, set by each HTTP handler at receipt, before tokenizing) and back-dated to wall time.ttft_s/total_srun from receipt;queue_wait_sstill runs from enqueue.ttft_sis set only when a real token was emitted (an EOS-first answer used to get a TTFT withtokens_out=0).tpot_s = (total_s - ttft_s)/(n - 1), same as the environment.decode_stepsnow counts forward passes (it used to betokens_out - 1, which is one short on EOS).cancelledandaborted.cancelled: a streaming client went away (the SSE generators flag the request), orsubmitwas cancelled. Active rows are evicted at the next step and pending ones are never admitted. Before this, a disconnected stream decoded to the end and was recorded asok.aborted:stop()used to leave queued and in-flight requests with no row and an unresolved future._fail_all) now also rejects pending requests. Before, they waited forever.CustomTorchBackend.prefill_batchdoes look up the prefix cache per row. It now reportslast_batch_cache_hit_tokens, and the scheduler resets it before each wave. Rows carryprefill_mode.cache_hit_tokensis NULL when no lookup was reported (never admitted, or a backend that doesn't report per-row hits).schema_version(1). The SQLite file gets ametatable (schema_version,run_id,rows_written,rows_dropped,closed), updated after every batch and finalised at close. A row put after close used to vanish into an undrained queue; it's now counted as dropped.Already right
trace_idis threaded fromX-Trace-Idthrough both shim routes, streaming or not, and echoed back.trace_idandstep.preemptedis set: preemption is terminal here, so it is 0 or 1.RowStoredrops were already in/scheduler/stats.Not changed (noted)
/generatenon-stream returnsttft_ms=0.prompt_logprobsscoring requests bypass the scheduler, so they have no row.Tests
pytest -q: 374 passed, 37 skipped.ruff check .: clean. New tests cover:submitX-Trace-Idjoining the row and the timeline end to end through the shim🤖 Generated with Claude Code