fix: use protobuf exporters for http/protobuf and add option http/json to keep old behavior#51
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis PR adds ChangesOTLP Protocol Support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
Thanks for the fix here. The exporter swap for Could you add a regression test for the actual behavior change in Right now the new test only covers config parsing, but the bug in #50 was specifically that That would make this much safer to merge and would prevent this protocol mapping from drifting again later. |
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 `@tests/otel.test.ts`:
- Around line 72-76: The afterEach teardown in the test uses sequential await
calls on providers?.tracerProvider.shutdown(),
providers?.loggerProvider.shutdown(), and providers?.meterProvider.shutdown()
which stops remaining shutdowns if one rejects; update the afterEach for
resilience by invoking all three shutdown promises concurrently with
Promise.allSettled (guarding against undefined
providers/tracerProvider/loggerProvider/meterProvider), wait for allSettled to
complete, optionally log or ignore individual rejections, and then set providers
= undefined; modify the afterEach function and references to
tracerProvider.shutdown, loggerProvider.shutdown, and meterProvider.shutdown
accordingly.
- Around line 24-26: The test currently dereferences internals directly
(meterProvider._sharedState.metricCollectors[0]!._metricReader._exporter,
loggerProvider._sharedState.activeProcessor.processors[0]!._exporter,
tracerProvider._activeSpanProcessor._spanProcessors[0]!._exporter) which will
throw opaque errors when those arrays are empty; add explicit guards that verify
metricCollectors.length > 0, activeProcessor.processors.length > 0, and
_spanProcessors.length > 0 (or use optional chaining and explicit assertions)
before accessing index 0, and if any are missing fail the test with a clear
message that the expected exporter is absent so assertions run only when
exporters are present.
🪄 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: Pro
Run ID: 9089b7fc-b658-49e8-874e-61886386884a
📒 Files selected for processing (1)
tests/otel.test.ts
4f344d0 to
2ada3da
Compare
|
Thanks for the review. I added regression tests for the protocol mapping behavior. They currently assert against the internal structure of the OpenTelemetry SDK objects to verify which exporters setupOtel wires up. If you'd prefer a less white-box approach, I can extract the exporter selection logic from setupOtel and test it directly |
|
Looks good! Thanks for contributing! |
Description
As noted in Issue #50 opentelemetry http exporters were sending traces as application/json. This results in 415 status code from Arize Phoenix.
This PR makes http/protobuf use the opentelemetry/exporter-*-otlp-proto.
In order to keep the old behavior with JSON payloads a "http/json" configuration option was added that uses the opentelemetry/exporter-*-http exporters.
Tests
I tested this on Arize Phoenix. The request is no longer rejected with a 415 Unsupported Media Type and the trace is correctly added.
Type of change
Checklist
bun run lintpasses with no errorsbun run check:jsdoc-coveragepasses with no errorsbun run typecheckpasses with no errorsbun testpasses with no errorsRelated issues
Fixes #50
Additional context
No additional context
Summary by CodeRabbit
New Features
Documentation
Chores
Tests