Skip to content

feat(otlp): add build() on base exporter builders to auto-select from env#3394

Open
scottgerring wants to merge 3 commits intoopen-telemetry:mainfrom
scottgerring:feat/add-default-builder
Open

feat(otlp): add build() on base exporter builders to auto-select from env#3394
scottgerring wants to merge 3 commits intoopen-telemetry:mainfrom
scottgerring:feat/add-default-builder

Conversation

@scottgerring
Copy link
Member

Fixes #3208.
With this change, a user can simply call build() on an exporter instead of having to explicitly choose tonic or http. Because we are only implementing this for NoExporterBuilderSet this doesn't cause ambiguity with the existing building pattern.

Changes

Please provide a brief description of the changes here.

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@codecov
Copy link

codecov bot commented Feb 26, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.1%. Comparing base (d10b025) to head (0341d48).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
opentelemetry-otlp/src/logs.rs 80.0% 2 Missing ⚠️
opentelemetry-otlp/src/metric.rs 80.0% 2 Missing ⚠️
opentelemetry-otlp/src/span.rs 80.0% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #3394     +/-   ##
=======================================
+ Coverage   82.7%   83.1%   +0.4%     
=======================================
  Files        128     128             
  Lines      24811   24841     +30     
=======================================
+ Hits       20526   20652    +126     
+ Misses      4285    4189     -96     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cijothomas
Copy link
Member

Lets add a changelog, and see if we can leverage this in the otlp examples in the repo?

Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM once changelog and tests are added.

A nice follow-up could be to support something like .with_endpoint("...").build() directly on the base builder, without having to pick with_tonic() or with_http() first. That way users can set things like endpoint or timeout in code while still letting the transport get picked automatically.

@scottgerring scottgerring force-pushed the feat/add-default-builder branch from 6ec7d53 to 0341d48 Compare March 3, 2026 08:15
@scottgerring
Copy link
Member Author

@cijothomas @lalitb feedback addressed should be good to go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: OTEL_EXPORTER_OTLP_PROTOCOL exists but is never used

3 participants