feat: 2602 agent workflow metrics 2#3491
Closed
skamenan7 wants to merge 2 commits intollamastack:mainfrom
Closed
Conversation
Add comprehensive OpenTelemetry-based metrics for agent observability: - Workflow completion/failure tracking with duration measurements - Step execution counters for performance monitoring - Tool usage tracking with normalized tool names - Non-blocking telemetry emission with named async tasks - Comprehensive unit and integration test coverage - Graceful handling when telemetry is disabled
- simplified test to use telemetry.query_metrics for verification - test now validates actual queryable metrics data - verified by query metrics functionality added in llamastack#3074
Contributor
Author
|
cc: @cdoern please review as you had developed query metrics and we thought of using that to test the metrics. Thanks! |
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.
What does this PR do?
Adds workflow metrics tracking to the agent system to monitor performance and usage patterns. The implementation
tracks step execution, workflow completion times, and tool usage with proper telemetry integration.
The metrics provide visibility into agent behavior and can be queried using the telemetry system. Tool names are
normalized for consistency (knowledge_search becomes rag).
Closes #2602
Test Plan
Integration Test:
LLAMA_STACK_CONFIG="http://localhost:8321" python -m pytest tests/integration/agents/test_agent_metrics_integratio n.py::TestAgentMetricsIntegration::test_agent_metrics_end_to_end -vvalidating:
Verifies metrics are properly collected and queryable, building on query functionality from #3074.
Please Note: Most of the code was reviewed in #2993 but we wanted to test the metrics using query_metrics from #3074 and I was focusing more on higher priory items. So I created this PR for easier reviews as commits were many and was not easy to follow.