Directly expose noop exporters for spans and logs.#8435
Conversation
|
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. |
|
Add for MetricExporter as well! |
Declarative config |
In the PR description I had written this:
Are you suggesting that I add a NoOpMetricExporter as part of this PR? |
Maybe one day, but reading files at startup on Android is a pretty serious no-no. |
|
needs japicmp run to get the new API surface exposed |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
worth adding a simple test for these two new methods? |
jack-berg
left a comment
There was a problem hiding this comment.
Looks good, but bumping this 😉 #8435 (comment)
jkwatson
left a comment
There was a problem hiding this comment.
API changes are a go from me.
Right now, there's a silly workaround for users that want to disable exporters -- they can simply use
SpanExporter.composite(emptyList())to get theNoOpSpanExporter.INSTANCEimplementation. 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? 🤷🏻