[https://nvbugs/6721558][fix] Only record first token time when collecting perf metrics - #18746
trtllm-agent wants to merge 1 commit into
Conversation
…on perf metrics Commit e11905f replaced the module-level get_steady_clock_now_in_seconds() with the instance-state read self._adjusted_steady_clock.now() at the three streaming first-token sites, but only gated the equivalent read in _extract_metrics on self._collect_perf_metrics. The ungated reads raised AttributeError on completion streaming and sampled a clock whose value is only consumed by build_request_metrics_record, which itself runs under _collect_perf_metrics. Route all three sites through a _record_server_first_token_time helper carrying the same gate. Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 12 included reviews per hour; 9 remain after this review. WalkthroughThe server centralizes guarded first-token timestamp recording. Chat, completion, Harmony, and non-streaming metric paths now use the shared helper. ChangesFirst-token metrics
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change prevents streaming requests from accessing the performance clock when metrics are disabled while preserving first-token timing when metrics are enabled. The affected request paths are consistently routed through the guarded helper, with no remaining merge-blocking risk identified. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/bot run |
|
PR_Github #72083 [ run ] triggered by Bot. Commit: |
|
PR_Github #72083 [ run ] completed with state
|
|
Original issue has been fixed and test unwaived by #18686 |
Summary
e11905f5c6swapped the statelessget_steady_clock_now_in_seconds()for the instance-stateself._adjusted_steady_clock.now()at three streaming first-token sites without applying theself._collect_perf_metricsgate it added at the equivalent_extract_metricsread._record_server_first_token_time()helper carrying the same_collect_perf_metricsgate as line 1762.pytest tests/unittest/llmapi/test_llm.py::test_openai_completion_list_prompt_stream_reuses_stream_metadata -vTest plan
Links
Reproduction comparison
Signature: AttributeError: 'OpenAIServer' object has no attribute '_adjusted_steady_clock'
Signature: AttributeError: 'OpenAIServer' object has no attribute '_adjusted_steady_clock'
Dev Engineer Review
_record_server_first_token_time()to centralize first-token timestamp recording._collect_perf_metrics, request availability, and existing timestamp state before recording._adjusted_steady_clockaccess and fixes the reported completion-streamingAttributeErrorregression.QA Engineer Review
No test files are touched.