-
Notifications
You must be signed in to change notification settings - Fork 900
Promote ComponentLoader to opentelemetry-context, 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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7446 +/- ##
============================================
+ Coverage 89.78% 89.83% +0.05%
- Complexity 6998 7012 +14
============================================
Files 798 800 +2
Lines 21204 21244 +40
Branches 2058 2058
============================================
+ Hits 19037 19084 +47
+ Misses 1503 1499 -4
+ Partials 664 661 -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
Show resolved
Hide resolved
...sions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/internal/SpiHelper.java
Show resolved
Hide resolved
+++ 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. |
Related to #7292, #7181, and convo in #7164.
Promote ComponentLoader to
opentelemetry-context
(i.e. the most core component in our dependency hierarchy) and standardize SPI loading throughout repo to use ComponentLoader.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).