Introduce DeclarativeConfigResult to eliminate reflection in IncubatingUtil#24
Merged
jack-berg merged 1 commit intojack-berg:break-incubator-autoconfigure-dependencyfrom Apr 7, 2026
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Builds on top of open-telemetry#8242.
The
sharedStatefield reflection inIncubatingUtilintroduced in open-telemetry#8242 is a regression — it accesses a private internal field ofSdkMeterProviderto extractResource, which is fragile and goes against the direction discussed in open-telemetry#7292.Change
Introduce
DeclarativeConfigResult(infileconfig.internal— not public API) as the return type ofDeclarativeConfiguration.create(). It carries both the configured SDK andResourceas first-class values, soIncubatingUtilcan read them directly with no reflection.Target module structure per open-telemetry#7292:
DeclarativeConfigResultis the natural precursor to the result type thatcreate()will need in the target architecture (wheresdk-configcannot depend onsdkand must return individual providers + resource rather than an assembledOpenTelemetrySdk).Does this match the target picture in open-telemetry#7292?