Repository navigation
Conversation
A poller can diff these counters into tok/s. Completion tokens move as they are emitted; prompt tokens and prefill time move when the first output token arrives. Co-authored-by: Cursor <[email protected]>
|
Nice — while touching this, would you also publish cumulative cached prompt tokens (e.g. So it's one line next to the existing That lets a poller diffing |
TL;DR:
GET /healthon the CUDA server now reports cumulative token counters while a request is running, so a poller can show live tok/s. Stock/healthwas{"ok": true}and had nothing to diff.The problem
The CUDA server has no
/metrics. Per-request timing (prefill_s,decode_s) is only on the chat completion body, which a monitor that is not the client never sees. While a generation is in flight,/healthstays{"ok": true}, so decode and prefill rates read as 0 for the whole run.The change
/healthand/v1/healthnow return:prompt_tokens_totalandprefill_seconds_total— updated when the first output token arrives (prompt length, and the time from the start of generation until that token)completion_tokens_total— updated as each emitted token batch arrives, not when the request finishesbusyandrequests_running— in-flight requestscontext_length— the server's prompt/reply window, when it is setbackend: "tensorfold"Idle is
busy: falseand the counters stop moving, so a diff over the poll window returns to 0. The first sample a poller sees should be treated as a baseline, not a rate.Tests
tests/test_cuda_server_health.py: a request held before its first token reportsbusywith unchanged counters; after four tokens the completion counter has moved by 4, the prompt counter and prefill time have moved, and the server is idle again.tests/test_cuda_server_health.pyandtests/test_cuda_server_disconnect.py: 18 passed locally.Live check on one DGX Spark (
tensorfold serveQwen3.8 Flash Next, 0.3.6.2 plus this patch): during a short generation/healthadvanced the counters and a 2s poll read about 25 tok/s decode and the prefill rate as prompt tokens ÷ prefill time, then both returned to 0.Made with Cursor