Repository navigation
feat(telemetry): enrich trace attributes and harden AI provider connection resilience - #672
Merged
Merged
Conversation
…ction resilience - Add zero-subprocess Git HEAD inspection for vcs.ref.name and vcs.revision_id - Add Kubernetes context and namespace detection for telemetry spans - Add automatic caller code inspection (code.filepath, code.function, code.lineno) - Enrich thread and process metadata (thread.name, thread.id, process.pid) - Add granular GenAI telemetry (gen_ai.response.model, gen_ai.server.served_by, gen_ai.tokens_per_second) - Harden OpenAI and Claude provider clients to use connection-pooled shared clients with tenacity retry transport - Add DEFAULT_AI_CONNECT_TIMEOUT_SECONDS (5.0s) to prevent spurious connect timeouts over WAN tunnels - Enhance provider HTTP error formatting to report informative HTTP status codes and details rather than masking as credential failures
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
Enriches OpenTelemetry traces with granular runtime, VCS, Kubernetes, caller location, and GenAI telemetry attributes, while hardening AI provider clients (OpenAI and Claude) against transient network drops, connect timeouts, and uninformative error masking during parallel branch reviews.
Key Changes
vcs.ref.nameandvcs.revision_id.k8s.context,k8s.namespace).code.filepath), function name (code.function), and line number (code.lineno).thread.name,thread.id,process.pid).gen_ai.response.model,gen_ai.server.served_by,gen_ai.tokens_per_second,gen_ai.request.temperature,gen_ai.request.top_p._shared_client()) rather than re-negotiating TLS handshakes on every prompt/file turn.create_retry_transport) for automatic exponential backoff andRetry-Afterheader parsing across transient 408, 429, 500, 502, 503, and 504 responses.DEFAULT_AI_CONNECT_TIMEOUT_SECONDS(5.0s) to prevent spurious connect timeouts over WAN ingress and Cloudflare tunnels._provider_http_errorto report informative HTTP status codes and response bodies (sanitized against secrets) rather than masking failures with generic credential warnings.Verification
uv run devops ci: 100% pass across all quality gates (python_version,test,coverage>= 90.6%,lint,format,typecheck,audit,security,actionlint,docs).tests/test_telemetry.py: 28 passed.tests/test_ai_client_retries.py: 11 passed.tests/test_architectural_invariants.py: 13 passed.