Skip to content

feat(server): log a 'Request done:' timing summary for every request (#841) - #898

Merged
tawei-amd merged 2 commits into
mainfrom
feat/request-timing-log
Oct 30, 2026
Merged

tawei-amd merged 2 commits into
mainfrom
feat/request-timing-log

Conversation

@tawei-amd

Copy link
Copy Markdown
Collaborator

Fixes #841.

flm serve now writes one line per finished request, streamed or not, whatever stream_options the client sets:

[FLM]  Request done: prompt 11 tokens (prefill 0.442 s, 24.88 tok/s), generated 10 tokens (decode 0.424 s, 23.61 tok/s), kv 21/32768, finish stop
  • Stable prefix Request done: for grep/parsing. Shows (N cached) when the prefix cache served part of the prompt; prefill tok/s counts only uncached tokens (same as usage).
  • Covers OpenAI /v1/chat/completions and /v1/completions, and Ollama /api/chat and /api/generate, each streamed and non-streamed.
  • Existing ChatCompletionChunk: / Usage: log lines are unchanged. Host-only change (rest_handler.cpp), no binaries.
  • Not logged: requests cancelled during prefill, and requests that fail with an error.

Tested: local build (Linux, Qwen3.5-2B), 8 requests (4 endpoints x stream/non-stream) -> 8 Request done: lines.

🤖 Generated with Claude Code

tawei-amd and others added 2 commits October 30, 2026 15:36
… streamed or not (#841)

One stable-prefix line per finished request: prompt tokens (and cached),
prefill time and tok/s, generated tokens, decode time and tok/s, kv use,
finish reason. Covers OpenAI chat/completions and Ollama chat/generate,
streamed or not, regardless of stream_options.include_usage.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@tawei-amd
tawei-amd merged commit 64d330a into main Oct 30, 2026
38 checks passed
@tawei-amd
tawei-amd deleted the feat/request-timing-log branch October 30, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Log a per-request timing summary for every request, streamed or not

1 participant