Repository navigation
perf(llm): avoid chat stream metrics JSON roundtrip - #10512
Merged
Merged
Conversation
Contributor
WalkthroughThis PR introduces typed metrics support for LLM streaming responses. A new shared ChangesMetrics Types and Chat Schema
Metrics Observation and SSE Conversion Pipeline
Preprocessor Integration and Type Migration
HTTP Service Wiring Update
Test Fixture Updates
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
jthomson04
force-pushed
the
codex/typed-llm-metrics-fastpath
branch
from
June 10, 2026 18:04
3aa6b5a to
a350a86
Compare
jthomson04
commented
Jun 10, 2026
Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
jthomson04
force-pushed
the
codex/typed-llm-metrics-fastpath
branch
from
June 24, 2026 17:09
082638b to
af8846a
Compare
jthomson04
temporarily deployed
to
external_collaborator
June 24, 2026 17:09 — with
GitHub Actions
Inactive
This comment has been minimized.
This comment has been minimized.
Contributor
Author
|
/ok to test af8846a |
KrishnanPrash
approved these changes
Jun 25, 2026
This branch was previously deployed
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
LLMMetricAnnotationfast path for chat-derived streaming responses.NvCreateChatCompletionStreamResponsewith#[serde(skip)]so OpenAI Chat, Responses, and Anthropic Messages avoid the per-chunk metrics JSON serialize/parse round trip.Annotated.event/commentJSON annotation path as a compatibility fallback for legacy/no-data metric frames.Where should the reviewer start?
lib/llm/src/preprocessor.rslib/llm/src/http/service/metrics.rslib/llm/src/protocols/common/metrics.rsRelated Issues
Validation
cargo test -p dynamo-llm http::service::metricscargo test -p dynamo-llm http::service::openaicargo test -p dynamo-llm protocols::openai::responsescargo test -p dynamo-llm anthropicmaturin develop --uv --release -m lib/bindings/python/Cargo.tomlBenchmark
Responses API c512 on-CPU profile with tokenizer cache enabled:
73,512requests with0errors.332.52 req/s.LLMMetricAnnotation/from_annotation: prior8.6-9.8%of frontend on-CPU samples, now0.0%.dynamo_llm::http::service::metricsinclusive: prior~7.1-7.8%, now2.3%.serde_json::read::StrRead: prior~1.34%, now0.003%.The benchmarked change is scoped to removing the chat-derived streaming metrics JSON round trip. Request-plane msgpack transport work is orthogonal and not included in this PR.
Summary by CodeRabbit
Refactor
Tests