Repository navigation
Conversation
Contributor
Contributor
✅ Dynamo PR CI passed — run 38887255376 (attempt 1) on
|
Native SGLang `/generate` only kept an inflight guard, so it recorded no TTFT, ITL, token, cached-token, or worker metrics, its "request completed" log carried no token or latency fields, and DYN_REQUEST_TRACE emitted no request_end rows for it. Reuse the vLLM `/inference/v1/generate` metric collector and dispatch span for both the unary and streaming paths. Build request-end trace state from the same WorkerSet selection that provides the KV block size, and wrap the raw engine stream with a generic `LLMEngineOutput` observer that records the backend finish reason and token usage before reusing the shared request-end emitter. The observer returns the stream unchanged when tracing is off. Tool calls are not parsed on this route, so its rows carry no tool-call metadata. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.com> Co-authored-by: ShaneGZhu <1092841848@qq.com>
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.com> Co-authored-by: ShaneGZhu <1092841848@qq.com>
…model clone Reuse the context's parsed agent context for the request (its headers are Arc-backed) instead of parsing the headers twice, as reviewed on #16489, and keep dispatch's model by move with the request id borrowed from the engine context. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.com> Co-authored-by: ShaneGZhu <1092841848@qq.com>
- Read the agent context with get_optional to avoid an error-string allocation on the common missing-key path. - Make request-end trace builders generic over Context<T> and drop the into_parts/rejoin dance in the SGLang handler and tests. - Resolve the metric model once in the handler and reuse it for cancellation labels, the dispatch span, the inflight guard, the collector, and rejection counts. - Move GenerateMetricCollector and generate_dispatch_span into a neutral engine_output_metrics module shared by both generate routes. - Engine-output request-end tracing leaves ISL to request construction, ignores cached tokens from migrated-attempt usage, and keeps the backend output index unchanged. - Move SGLang generate tests to sglang_generate_tests.rs and trim them to SGLang-specific wiring. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: ShaneGZhu <1092841848@qq.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.com>
…ervability Add LLMEngineOutput::cached_tokens_for_prompt and use it for both the native generate frontend metrics and request-trace token recording, simplify the engine-output request-end wrapper, drop the unused get_generate_engine_for_capability helpers, clarify that native /generate trace rows carry the backend finish reason only with session headers, and tidy test helpers. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: ShaneGZhu <1092841848@qq.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.com>
Aphoh
force-pushed
the
warnold/sglang-generate-observability
branch
from
October 16, 2026 10:26
d09bcc6 to
0d37273
Compare
Contributor
Author
|
Closing: #16983 unifies the native generate handlers and takes over the frontend metrics part. The request-end tracing part will be redone as a small follow-up on the unified handler, owned separately. |
Aphoh
added a commit
that referenced
this pull request
Oct 22, 2026
Adapt request-end tracing from #16641 at the shared generate handler. Preserve cancellation and prefill phase semantics, and exclude opaque multimodal payloads from replay. Part of #16640 Co-authored-by: ShaneGZhu <1092841848@qq.com> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.com>
Aphoh
added a commit
that referenced
this pull request
Oct 22, 2026
Adapt request-end tracing from #16641 at the shared generate handler. Preserve cancellation and prefill phase semantics, and exclude opaque multimodal payloads from replay. Part of #16640 Co-authored-by: ShaneGZhu <1092841848@qq.com> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: gongshaotian <gstian5555@outlook.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.com>
Aphoh
added a commit
that referenced
this pull request
Oct 22, 2026
Adapt request-end tracing from #16641 at the shared generate handler. Preserve cancellation and prefill phase semantics, and exclude opaque multimodal payloads from replay. Part of #16640 Co-authored-by: ShaneGZhu <1092841848@qq.com> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: gongshaotian <gstian5555@outlook.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.com>
Aphoh
added a commit
that referenced
this pull request
Oct 22, 2026
Adapt request-end tracing from #16641 at the shared generate handler. Preserve cancellation and prefill phase semantics, and exclude opaque multimodal payloads from replay. Part of #16640 Co-authored-by: ShaneGZhu <1092841848@qq.com> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: gongshaotian <gstian5555@outlook.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.com>
Aphoh
added a commit
that referenced
this pull request
Oct 22, 2026
Adapt request-end tracing from #16641 at the shared generate handler. Preserve cancellation and prefill phase semantics, and exclude opaque multimodal payloads from replay. Part of #16640 Co-authored-by: ShaneGZhu <1092841848@qq.com> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: gongshaotian <gstian5555@outlook.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.com>
Aphoh
added a commit
that referenced
this pull request
Oct 23, 2026
Adapt request-end tracing from #16641 at the shared generate handler. Preserve cancellation and prefill phase semantics, and exclude opaque multimodal payloads from replay. Part of #16640 Co-authored-by: ShaneGZhu <1092841848@qq.com> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: gongshaotian <gstian5555@outlook.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.com>
Aphoh
added a commit
that referenced
this pull request
Oct 26, 2026
Adapt request-end tracing from #16641 at the shared generate handler. Preserve cancellation and prefill phase semantics, and exclude opaque multimodal payloads from replay. Part of #16640 Co-authored-by: ShaneGZhu <1092841848@qq.com> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: gongshaotian <gstian5555@outlook.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.com>
Aphoh
added a commit
that referenced
this pull request
Oct 26, 2026
Adapt request-end tracing from #16641 at the shared generate handler. Preserve cancellation and prefill phase semantics, and exclude opaque multimodal payloads from replay. Part of #16640 Co-authored-by: ShaneGZhu <1092841848@qq.com> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: gongshaotian <gstian5555@outlook.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.com>
Aphoh
added a commit
that referenced
this pull request
Oct 28, 2026
Adapt request-end tracing from #16641 at the shared generate handler. Preserve cancellation and prefill phase semantics, and exclude opaque multimodal payloads from replay. Part of #16640 Co-authored-by: ShaneGZhu <1092841848@qq.com> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: gongshaotian <gstian5555@outlook.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.com>
Aphoh
added a commit
that referenced
this pull request
Oct 29, 2026
Adapt request-end tracing from #16641 at the shared generate handler. Preserve cancellation and prefill phase semantics, and exclude opaque multimodal payloads from replay. Part of #16640 Co-authored-by: ShaneGZhu <1092841848@qq.com> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: gongshaotian <gstian5555@outlook.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.com>
Aphoh
added a commit
that referenced
this pull request
Oct 30, 2026
Adapt request-end tracing from #16641 at the shared generate handler. Preserve cancellation and prefill phase semantics, and exclude opaque multimodal payloads from replay. Part of #16640 Co-authored-by: ShaneGZhu <1092841848@qq.com> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: gongshaotian <gstian5555@outlook.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.com>
Aphoh
added a commit
that referenced
this pull request
Nov 1, 2026
Adapt request-end tracing from #16641 at the shared generate handler. Preserve cancellation and prefill phase semantics, and exclude opaque multimodal payloads from replay. Part of #16640 Co-authored-by: ShaneGZhu <1092841848@qq.com> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: gongshaotian <gstian5555@outlook.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.com>
Aphoh
added a commit
that referenced
this pull request
Nov 1, 2026
Adapt request-end tracing from #16641 at the shared generate handler. Preserve cancellation and prefill phase semantics, and exclude opaque multimodal payloads from replay. Part of #16640 Co-authored-by: ShaneGZhu <1092841848@qq.com> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: gongshaotian <gstian5555@outlook.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.com>
Aphoh
added a commit
that referenced
this pull request
Nov 1, 2026
Adapt request-end tracing from #16641 at the shared generate handler. Preserve cancellation and prefill phase semantics, and exclude opaque multimodal payloads from replay. Part of #16640 Co-authored-by: ShaneGZhu <1092841848@qq.com> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: gongshaotian <gstian5555@outlook.com> Signed-off-by: William Arnold <7565007+Aphoh@users.noreply.github.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.
Summary
Native SGLang
/generatenow records the same frontend observability as/v1/completions. Closes #16640.Builds on #16504 (merged: workers send typed output tokens, finish reason and usage). It also includes #16489's commit (agent context from headers on native generate requests) with that PR's review feedback applied; that commit drops out of this diff once #16489 merges. Co-authored with @ShaneGZhu.
Frontend only, reusing existing code:
/generaterecordsdynamo_frontend_*TTFT, ITL, output tokens and length, ISL, cached tokens and theworker_last_*gauges, in both streaming and unary./inference/v1/generatealready had, moved into a neutralengine_output_metrics.rs.request completedlog line now carries token counts, TTFT, ITL and worker IDs./generatewrites oneDYN_REQUEST_TRACErecord per request, including on cancellation.x-request-idand the backend finish reason.wrap_engine_output_request_end_streamobserves typedLLMEngineOutputand reuses the existing request-end emit path. When tracing is off it returns the stream unchanged./generate.get_optional, so no allocation when the headers are absent).&Context<T>, so the request is no longer moved out of its context and back./generaterejection counter now uses the metric model label, as vLLM does.sglang_generate.rstests move tosglang_generate_tests.rs./generatecoverage is noted on the request-trace and agent-tracing pages.Validation
cargo clippy -p dynamo-llm --lib --tests -- -D warningscargo test -p dynamo-llm --lib -- sglang request_trace generate preprocessed_contextcargo test -p dynamo-llm --lib --no-default-features request_tracepre-commiton the changed filesGPU (B200), aggregated serving. Stock SGLang 0.5.21 in the container,
Qwen/Qwen3-0.6B; the sidecar and this branch's frontend run on the host./generaterequestx-request-idagent_context(session and parent),x_request_id, finishlengthClient responses are unchanged (
text,output_ids,meta_info).Generated with Devin