Skip to content

feat(metrics): time each request's decode, so generated tokens turn into a decode rate - #269

Closed
sxuff wants to merge 1 commit into
ashhart:mainfrom
sxuff:metrics-decode-seconds
Closed

sxuff wants to merge 1 commit into
ashhart:mainfrom
sxuff:metrics-decode-seconds

Conversation

@sxuff

@sxuff sxuff commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

/metrics counts generation_tokens_total, but there's nothing to divide it by for a decode rate: request_latency_seconds includes the prompt pass and queueing.

This adds one histogram, tensorfold:request_decode_seconds, observed once per finished request, plus the same reading under vLLM's name, request_decode_time_seconds, like the other mirrored families.

  • CUDA: the engine's own decode_s, the figure /health already sums as decode_seconds_total.
  • Mac server: the time from the first generated token to the end.
  • A request that generated nothing observes nothing, so the family never carries a made-up zero.

A scraper then gets the completed-decode rate as Δgeneration_tokens_total / Δrequest_decode_seconds_sum. I run TensorFold on a GB10 and read that rate into a small telemetry feed.

Changed: server/metrics.py (histogram, note(decode=...), Mac finish_request), cuda/health.py (passes the engine's decode_s), docs/api.md, and a test in tests/test_metrics.py covering both paths. pytest tests/test_metrics.py: 9 passed, 4 skipped (MLX-only).

… turn generated tokens into a decode rate

generation_tokens_total had no decode time to divide by: request_latency_seconds includes the prompt pass and
queueing. request_decode_seconds (and request_decode_time_seconds under vLLM's name) observes each finished
request's decode time: the CUDA engine's own decode_s, the figure /health already sums as decode_seconds_total,
or first token to end on the Mac server. A request that generated nothing observes nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ashhart

ashhart commented Oct 2, 2026

Copy link
Copy Markdown
Owner

This is in TensorFold 0.6.3, with your commit under your name in the release history: https://github.com/ashhart/TensorFold/releases/tag/v0.6.3

/metrics now times each request's decode, so a scraper can turn generated tokens into a decode rate.

Thank you, @sxuff!

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.

2 participants