Fix observability metrics and error handling in Graph API client#458
Merged
Fix observability metrics and error handling in Graph API client#458
Conversation
…nks method - Improved error handling to classify response errors as client, server, or timeout. - Added metrics for time-to-first-byte and error types during streaming operations. - Updated NDJSON line parsing with enhanced logging for JSON decode errors.
…hunks method - Simplified error handling by removing unnecessary variables for stream status and error type. - Enhanced metrics tracking to ensure accurate recording of errors and response statuses. - Improved clarity in exception handling for timeout and transient errors.
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
This PR enhances the observability and error handling in the
GraphClient.stream_chunksmethod, improving the reliability and debuggability of Graph API query operations.Key Accomplishments
Graph API Client (
robosystems/graph_api/client/client.py)stream_chunksmethod to provide more granular and robust error handling, ensuring failures are properly caught, categorized, and surfacedOTel Metrics (
robosystems/middleware/otel/metrics.py)Breaking Changes
None. The changes are additive improvements to error handling and metrics instrumentation. Existing API contracts and method signatures are preserved.
Testing Notes
stream_chunksmethod correctly emits metrics on both successful and failed query operationsInfrastructure Considerations
🤖 Generated with Claude Code
Branch Info:
bugfix/graph-api-query-o11y-fixmainCo-Authored-By: Claude noreply@anthropic.com