Skip to content

Directly expose noop exporters for spans and logs.#8435

Open
breedx-splk wants to merge 5 commits into
open-telemetry:mainfrom
breedx-splk:expose-noop-span-exporter
Open

Directly expose noop exporters for spans and logs.#8435
breedx-splk wants to merge 5 commits into
open-telemetry:mainfrom
breedx-splk:expose-noop-span-exporter

Conversation

@breedx-splk
Copy link
Copy Markdown
Contributor

Right now, there's a silly workaround for users that want to disable exporters -- they can simply use SpanExporter.composite(emptyList()) to get the NoOpSpanExporter.INSTANCE implementation. Sure, this is an implementation detail, but its also pretty obvious that when you composite nothing you get nothing. And that just reads clunky.

Since we already have these NoOp implementations, let's just expose them more directly. The implementation is still completely internal, and yes, this does very slightly increase the api surface area, but I think it's within reason and should be an improvement over the composite hack.

Why not metrics? Welp, we don't have an existing NoOpMetricExporter. I'm not entirely sure why, but it might be due to the spec requiring the NoOp API implementation for metrics? 🤷🏻

@breedx-splk breedx-splk requested a review from a team as a code owner May 29, 2026 00:49
@breedx-splk
Copy link
Copy Markdown
Contributor Author

breedx-splk commented May 29, 2026

Additional context: We have an Android user/contributor who wants to turn off spans and metrics and only ever export logs. Right now, there isn't a great way to do that through our high-level DSL...so while I was looking into how we might one day implement this, I came across this little gap.

@jack-berg
Copy link
Copy Markdown
Member

Add for MetricExporter as well!

@jack-berg
Copy link
Copy Markdown
Member

Right now, there isn't a great way to do that through our high-level DSL...so while I was looking into how we might one day implement this, I came across this little gap.

Declarative config

@breedx-splk
Copy link
Copy Markdown
Contributor Author

Add for MetricExporter as well!

In the PR description I had written this:

Why not metrics? Welp, we don't have an existing NoOpMetricExporter. I'm not entirely sure why, but it might be due to the spec requiring the NoOp API implementation for metrics? 🤷🏻

Are you suggesting that I add a NoOpMetricExporter as part of this PR?

@breedx-splk
Copy link
Copy Markdown
Contributor Author

Declarative config

Maybe one day, but reading files at startup on Android is a pretty serious no-no.

@jkwatson
Copy link
Copy Markdown
Contributor

jkwatson commented Jun 1, 2026

needs japicmp run to get the new API surface exposed

@otelbot otelbot Bot added the api-change Changes to public API surface area label Jun 1, 2026
@otelbot
Copy link
Copy Markdown
Contributor

otelbot Bot commented Jun 1, 2026

⚠️ API changes detected — additional maintainer review required

@jack-berg @jkwatson

This PR modifies the public API surface area of the following module(s):

  • opentelemetry-sdk-logs
  • opentelemetry-sdk-trace

Please review the changes in docs/apidiffs/current_vs_latest/ carefully before approving.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.01%. Comparing base (2f1d950) to head (6ab6e04).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8435      +/-   ##
============================================
+ Coverage     90.96%   91.01%   +0.04%     
- Complexity     7809     7817       +8     
============================================
  Files           892      892              
  Lines         23702    23720      +18     
  Branches       2361     2364       +3     
============================================
+ Hits          21561    21589      +28     
+ Misses         1420     1409      -11     
- Partials        721      722       +1     

☔ 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.

@jkwatson
Copy link
Copy Markdown
Contributor

jkwatson commented Jun 2, 2026

worth adding a simple test for these two new methods?

Copy link
Copy Markdown
Member

@jack-berg jack-berg left a comment

Choose a reason for hiding this comment

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

Looks good, but bumping this 😉 #8435 (comment)

Copy link
Copy Markdown
Contributor

@jkwatson jkwatson left a comment

Choose a reason for hiding this comment

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

API changes are a go from me.

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

Labels

api-change Changes to public API surface area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants