Support standard OTEL SDK environment variables#98
Conversation
The tracer initialization now respects all standard OTEL_* environment variables instead of only OTEL_EXPORTER_OTLP_ENDPOINT: - OTEL_SERVICE_NAME: Override service name - OTEL_EXPORTER_OTLP_INSECURE: Explicit TLS control - OTEL_EXPORTER_OTLP_PROTOCOL: Protocol selection (grpc/http) - OTEL_EXPORTER_OTLP_HEADERS: Custom headers (auth tokens) - OTEL_RESOURCE_ATTRIBUTES: Additional resource attributes - OTEL_TRACES_EXPORTER: Exporter selection (otlp/console/none) Also adds opentelemetry-exporter-otlp-proto-http dependency to support the HTTP protocol option. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.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)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds an OTLP HTTP exporter dependency and updates tracer initialization to build resources from OTEL environment variables, select exporter transport/protocol, and parse exporter headers. ChangesOTel tracing setup
Sequence Diagram(s)sequenceDiagram
participant App
participant init_tracer
participant Resource
participant OTLPExporter
participant TracerProvider
App->>init_tracer: call init_tracer()
init_tracer->>Resource: build from OTEL_SERVICE_NAME and OTEL_RESOURCE_ATTRIBUTES
init_tracer->>init_tracer: read OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_TRACES_EXPORTER, OTEL_EXPORTER_OTLP_PROTOCOL
init_tracer->>OTLPExporter: configure transport, TLS, and headers
init_tracer->>TracerProvider: attach BatchSpanProcessor
TracerProvider-->>App: tracer ready
Related Issues: None specified. Related PRs: None specified. Suggested labels: tracing, dependencies Suggested reviewers: None specified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/lightspeed_agentic/tracing.py`:
- Line 11: The OTEL_TRACES_EXPORTER documentation and implementation are
inconsistent because the documented console mode is not actually handled in
tracing.py. Update the exporter selection logic in the tracing setup so the
TracerProvider/export configuration explicitly supports
OTEL_TRACES_EXPORTER=console (for example by wiring a console/span exporter
path) or remove console from the documented options, and make sure the same
behavior is reflected wherever exporter choices are parsed or described,
including the traced setup around the exporter selection and related lines near
the fallback handling.
- Around line 67-75: The OTLP header parsing in tracing.py should decode
URL-encoded header values before they are appended to the headers list. Update
the custom header handling in the logic that reads OTEL_EXPORTER_OTLP_HEADERS so
that each parsed value is unquoted/decoded after splitting key and value, while
keeping the existing headers_env parsing and headers.append flow intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: ac6c5565-863e-459c-96a6-06b7693a095c
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock,!uv.lock
📒 Files selected for processing (2)
pyproject.tomlsrc/lightspeed_agentic/tracing.py
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
openshift/lightspeed-agentic-operator(manual)
…ders - Remove 'console' from OTEL_TRACES_EXPORTER documentation (not implemented) - URL-decode OTEL_EXPORTER_OTLP_HEADERS values per OTEL spec (W3C Baggage format) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@pavolloffay: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
OTEL_SERVICE_NAME,OTEL_EXPORTER_OTLP_INSECURE,OTEL_EXPORTER_OTLP_PROTOCOL,OTEL_EXPORTER_OTLP_HEADERS,OTEL_RESOURCE_ATTRIBUTES,OTEL_TRACES_EXPORTERopentelemetry-exporter-otlp-proto-httpdependency for HTTP protocol supportTest plan
OTEL_EXPORTER_OTLP_ENDPOINTonly (backward compatible)OTEL_SERVICE_NAMEoverrideOTEL_EXPORTER_OTLP_INSECURE=truefor explicit TLS controlOTEL_TRACES_EXPORTER=nonedisables exportTest Image:
ghcr.io/pavolloffay/lightspeed-agentic-sandbox:otel-sdk-autoconfig🤖 Generated with Claude Code