Break sdk incubator dependency on autoconfigure#8242
Break sdk incubator dependency on autoconfigure#8242jack-berg merged 9 commits intoopen-telemetry:mainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8242 +/- ##
============================================
- Coverage 90.32% 90.27% -0.06%
- Complexity 7654 7656 +2
============================================
Files 843 844 +1
Lines 23080 23073 -7
Branches 2312 2315 +3
============================================
- Hits 20848 20830 -18
- Misses 1516 1522 +6
- Partials 716 721 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…y-java into break-incubator-autoconfigure-dependency
…ngUtil Replace SdkMeterProvider.sharedState field reflection with a DeclarativeConfigResult internal DTO that carries both the SDK and Resource as first-class return values from DeclarativeConfiguration.create(). DeclarativeConfigResult lives in the fileconfig.internal package to signal it is not public API, avoiding any increase in API surface while still being accessible to autoconfigure via compileOnly dependency. Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
zeitlinger
left a comment
There was a problem hiding this comment.
Looks great - I've created jack-berg#24 which would get rid of the remaining reflection usage.
I'm approving regardless - I know we discussed Resource quite a bit 😄
Introduce DeclarativeConfigResult to eliminate reflection in IncubatingUtil
|
Merged! Yeah I figured we'd ultimately have to go in this type of direction, but was resisting adding "yet another component wrapper", adding to the list of:
Of course this could be solved by exposing Resource from OpenTelemetrySdk or ExtendedOpenTelemetrySdk but that comes with verification problems, since it will be tricky to retrofit the existing APIs to guarantee that the ExtendedOpenTelemetrySdk#getResource matches the resource associated with SdkTracerProvider, SdkMeterProvider, SdkLoggerProvider. AutoConfiguredOpenTelemetrySdk is a no go since its in autoconfigure. Going to do a small additional change to move DeclarativeConfigResult to the main package instead of internal, since its a key part of the API there's really no point hiding it in an internal. |
I thought it would be an easier sell in internal 😏 |
Related to #7292
Right now declarative config in the
opentelemetry-sdk-extension-incubatormodule depends on autoconfigure for a few key bits of functionality:otel.service.attributes, which is reused to handle.resource.attributes_listThese dependencies require autoconfigure to load file config via reflection in order to avoid a circular dependency. Ultimately, we want some sort of dedicated config module, with autoconfigure having a dependency on it. This requires we break the incubator -> autoconfigure dependency, which is what this PR does.
Changes:
otel.resource.attributesparsing logic to declarative config. This allows the code to be reused without having to move to a central public location likeopentelemetry-sdk-common, and without having to manually synchronize the content.