OSGi support and tests for OTLP exporters#8401
Conversation
|
cc previous reviewers @royteeuwen, @laeubi, @stbischof. You're feedback was really helpful / appreciated for the first round. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8401 +/- ##
============================================
- Coverage 90.88% 90.87% -0.01%
+ Complexity 7985 7984 -1
============================================
Files 898 898
Lines 24107 24107
Branches 2406 2406
============================================
- Hits 21909 21908 -1
Misses 1455 1455
- Partials 743 744 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Starts to look good, a lot of tests. Will validate if I can update my project to use these bundles instead of my own rewrapped ones: https://github.com/orbinson/aemaacs-opentelemetry-instrumentation You had to do some manual fixes in gradle it seems, the latest BND plugin wasn't correctly detecting it? |
That would be great!
Correctly detecting what? The SPI provides / requires instructions? |
|
Tested on a running AEMaaCS SDK 2026.2 (OSGi with Apache Felix). What works
Remaining issuesIssue 1 —
|
…s.* to avoid split package, add sun.misc as optional unversioend unversioned
|
Thanks @royteeuwen. Check out 95912aa:
|
|
Tested the latest commit Works
Remaining issue: 3 mandatory imports in
|
| Forced bundle | Real purpose |
|---|---|
opentelemetry-api-incubator (alpha) |
Incubator metrics/instrumentation APIs |
opentelemetry-sdk-extension-declarative-config (alpha) |
Loading SDK config from a YAML/JSON file |
opentelemetry-sdk-extension-incubator (alpha) |
Incubator sampler impls (pulled by declarative-config) |
jackson-annotations 2.21+ |
YAML/JSON parsing for declarative config |
jackson-core 2.21+ |
YAML/JSON parsing for declarative config |
jackson-databind 2.21+ |
YAML/JSON parsing for declarative config |
snakeyaml-engine 2.10+ |
YAML parsing for declarative config |
Suggested fix: add the three packages to osgiOptionalPackages in sdk-extensions/autoconfigure/build.gradle.kts, same as the PR already does for javax.annotation, sun.misc, io.grpc, etc. The runtime code paths already catch ClassNotFoundException / LinkageError for missing declarative-config; the change is purely making the OSGi manifest reflect what's already true in the bytecode.
After the fix the MVP install is 14 stable (no -alpha) bundles + 0 non-OTel deps for the JDK sender variant
Lower-priority
io.opentelemetry.sdk.autoconfigure.spi.* mandatorily imported by exporter-common and exporter-otlp/all. Users who construct the SDK programmatically (like the PR's own OtlpHttp*Test integration tests) don't touch these types but still must ship autoconfigure-spi so the manifests resolve. Marking them resolution:=optional in the exporter bundles would let programmatic users drop autoconfigure-spi entirely.
|
Thanks @royteeuwen! I was planning on working on getting autoconfigure and related SPIs working in the next PR. Now that the pattern for establishing new OSGi test suites and specifying SPI provides / requires is established here, it should be much easier to extend those patterns to the remaining modules. Trying to avoid any one PR getting too large |
|
@jack-berg don't get me wrong, the autoconfigure does work! it just now is mandatory to make it work in OSGi, while with the four suggested optional import packages, they are no longer required but optional to use. But happy to give that review again in a follow-up PR :) |
Related to #768, followup to #7964.
Extend OSGi support to OTLP exporters by including appropriate metadata to resolve sender SPI.
Rework
:integration-tests:osgito add a helper to create OSGi test suite bundles consisting of different combinations of dependencies. With this PR, there are test suites for:I did a before an after of each impacted artifact's
MODULE.MFto make it easier to review:opentelemetry-commonBefore (1.62.0)
After (1.62.0-SNAPSHOT)
opentelemetry-exporter-commonBefore (1.62.0)
After (1.62.0-SNAPSHOT)
opentelemetry-exporter-otlpBefore (1.62.0)
After (1.62.0-SNAPSHOT)
opentelemetry-exporter-otlp-commonBefore (1.62.0)
After (1.62.0-SNAPSHOT)
opentelemetry-exporter-sender-jdkBefore (1.62.0)
After (1.62.0-SNAPSHOT)
opentelemetry-exporter-sender-okhttpBefore (1.62.0)
After (1.62.0-SNAPSHOT)
opentelemetry-sdk-extension-autoconfigure-spiBefore (1.62.0)
After (1.62.0-SNAPSHOT)