Metrics update - #635
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (6)
Included review availability: Your plan includes up to 8 reviews per rolling hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe change expands Merge Risk: 🟡 Moderate · up to The PR adds richer metrics and a final call summary, but two current issues can leave TransformersVLM time-to-first-token data missing and allow an outdated periodic event after the final summary, resulting in incomplete or inconsistent metrics for consumers. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
tests/test_observability.py (1)
55-76: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy liftRemove mock-based OpenTelemetry assertions.
Remove
mock_metricsand allassert_called_once_withchecks. AssertAgentMetricsstate in unit tests. Test root-only OpenTelemetry emission with a real exporter in an@pytest.mark.integrationtest.Sources: Coding guidelines, Path instructions
plugins/huggingface/vision_agents/plugins/huggingface/transformers_vlm.py (1)
246-250: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftPopulate TTFT before forwarding it.
TransformersVLM.create_response()never setsLLMResponseFinal.time_to_first_token_ms. The final response is emitted without this field at Line 367-373, and the only delta sets it toNoneat Line 365. The collector therefore records no TTFT samples for Transformers inference. Measure the first token during generation and set the value on the final response, or remove this provider from the TTFT metric claim.agents-core/vision_agents/core/agents/agents.py (1)
804-810: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winStop the metrics broadcast task before sending the final summary.
_metrics_broadcast_taskis cancelled only after_emit_call_metrics_summary(). If the broadcast loop is already sending anagent_metricsevent, that event can arrive aftercall_metrics_summary. Cancel and await the broadcast task before emitting the final summary.Proposed ordering fix
- # Emit final call metrics while the edge connection is still up. - await self._emit_call_metrics_summary() - # Stop metrics broadcast task if self._metrics_broadcast_task: await cancel_and_wait(self._metrics_broadcast_task) self._metrics_broadcast_task = None + + # Emit final call metrics while the edge connection is still up. + await self._emit_call_metrics_summary()
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: fe64ebd3-89c1-4426-a28f-c0992bf93452
📒 Files selected for processing (20)
CHANGELOG.mdagents-core/vision_agents/core/agents/agents.pyagents-core/vision_agents/core/llm/realtime.pyagents-core/vision_agents/core/observability/__init__.pyagents-core/vision_agents/core/observability/agent.pyagents-core/vision_agents/core/observability/collector.pyagents-core/vision_agents/core/observability/metrics.pyagents-core/vision_agents/core/tts/events.pyagents-core/vision_agents/core/tts/tts.pyexamples/01_simple_agent_example/simple_agent_example.pyplugins/gemini/vision_agents/plugins/gemini/gemini_vlm.pyplugins/huggingface/vision_agents/plugins/huggingface/huggingface_vlm.pyplugins/huggingface/vision_agents/plugins/huggingface/transformers_vlm.pyplugins/moondream/vision_agents/plugins/moondream/vlm/moondream_cloud_vlm.pyplugins/moondream/vision_agents/plugins/moondream/vlm/moondream_local_vlm.pyplugins/nvidia/vision_agents/plugins/nvidia/nvidia_vlm.pyplugins/openai/vision_agents/plugins/openai/chat_completions/chat_completions_vlm.pyplugins/twelvelabs/vision_agents/plugins/twelvelabs/pegasus_vlm.pytests/test_observability.pytests/test_tts_base.py
Included review availability: Your plan includes up to 8 reviews per rolling hour; 7 remain after this review.
Co-authored-by: Cursor <cursoragent@cursor.com>
Why
Changes
call_metrics_summaryevent with all data (not changing the existingagent_metricsbroadcast event)