-
Notifications
You must be signed in to change notification settings - Fork 920
Promote ComponentLoader to new opentelemetry-api-util, standardize SPI loading #7446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Promote ComponentLoader to new opentelemetry-api-util, standardize SPI loading #7446
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7446 +/- ##
============================================
- Coverage 89.96% 89.95% -0.01%
- Complexity 7034 7042 +8
============================================
Files 799 801 +2
Lines 21256 21296 +40
Branches 2061 2061
============================================
+ Hits 19122 19157 +35
- Misses 1479 1481 +2
- Partials 655 658 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
why not |
Couple reasons:
|
…y-java into promote-component-loader
...s/autoconfigure/src/test/java/io/opentelemetry/sdk/autoconfigure/internal/SpiHelperTest.java
Outdated
Show resolved
Hide resolved
...sions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/internal/SpiHelper.java
Outdated
Show resolved
Hide resolved
| +++ NEW SUPERCLASS: java.lang.Object | ||
| +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.context.ComponentLoader forClassLoader(java.lang.ClassLoader) | ||
| +++ NEW METHOD: PUBLIC(+) ABSTRACT(+) java.lang.Iterable<T> load(java.lang.Class<T>) | ||
| GENERIC TEMPLATES: +++ T:java.lang.Object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI new API surface area @jkwatson
|
It is a little weird to put this in the context package, but I do understand the reasons for it. It makes me wonder if we should just move the context into the API itself, rather than have it live separately. Is there a way we could do that in a non-breaking way, I wonder? I won't hold up this PR, but it does end up feeling a little surprising to require someone to depend explicitly on the context artifact in order to load an SPI. 🤔 |
Remember that you don't have to explicitly depend on context since But yeah there's an argument that context and api should be combined. The decision to have them separate was before my time and if memory serves, the reasoning was that its useful for the java ecosystem to have a quality context propagation API that doesn't require you to bring other OpenTelemetry API concepts. I think this is a decent argument, but not sure if anyone is leveraging I think my main rub on this PR is the package this lives in: @jkwatson will wait for your thoughts on this before proceeding because I want to get this right. |
I do like the idea of having a separate utils artifact for stuff like this. I would definitely invite a draft PR to see what that might look like. |
I pushed a commit to do this. Couple of things to note / discuss:
|
jkwatson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it! Don't love YAA (yet another artifact), but structurally this feels correct to me. Thanks!
No strong opinion on |
Went with |
…y-java into promote-component-loader
Related to #7292, #7181, and convo in #7164.
Promote ComponentLoader to
opentelemetry-common, a new artifact with common utilities shared betweenopentelemetry-apiandopentelemetry-context.Extend ConfigProperties, DeclarativeConfigProperties with new getComponentLoader method, allowing any component participating in configuration to use the ComponentLoader configured via AutoConfiguredOpenTelemetrySdkBuilder#setComponentLoader (i.e. like the one configured in the agent and spring boot starter).
Update all OTLP exporter SPI implementations to use the component loader from ConfigProperties / DeclarativeConfigProperties to load various OTLP SPIs including HttpSenderProvider, GrpcSenderProvider, and CompressorProvider (once #7428 is merged).