Fix Groovy OpenTelemetrySdk builder loading#8407
Open
ADITYA-CODE-SOURCE wants to merge 2 commits into
Open
Conversation
psx95
reviewed
May 14, 2026
| } | ||
|
|
||
| @Test | ||
| void builder_fromGroovyWithoutIncubator() throws Exception { |
Contributor
There was a problem hiding this comment.
Nit: Could rename the test to buildFromGroovyWithoutIncubator
Comment on lines
+177
to
+182
| if (cause instanceof RuntimeException) { | ||
| throw (RuntimeException) cause; | ||
| } | ||
| if (cause instanceof Error) { | ||
| throw (Error) cause; | ||
| } |
Contributor
There was a problem hiding this comment.
Can you add some comments justifying the reasons for this handling?
| try { | ||
| return (OpenTelemetrySdk) | ||
| requireNonNull(CREATE_EXTENDED_OPEN_TELEMETRY_SDK_METHOD) | ||
| .invoke(null, openTelemetrySdk, configProvider); |
Contributor
There was a problem hiding this comment.
Nit: Looking at the javadoc for invoke, it throws 3 checked exceptions:
- IllegalAccessException
- IllegalArgumentException
- InvocationTargetException
Might be good to add handling for IllegalArgumentException (although it is less likely since arguments are controlled).
| * io.opentelemetry.sdk.internal.SdkConfigProvider)}. | ||
| */ | ||
| OpenTelemetrySdkBuilder setConfigProvider(SdkConfigProvider configProvider) { | ||
| OpenTelemetrySdkBuilder setConfigProvider(Object configProvider) { |
Contributor
There was a problem hiding this comment.
Question: Why was this changed to Object?
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.
Fixes #8198
This avoids eager Groovy linkage of incubator-dependent SDK code by resolving IncubatingUtil.createExtendedOpenTelemetrySdk(...) reflectively in OpenTelemetrySdkBuilder instead of calling it directly.
Also adds a Groovy regression test covering OpenTelemetrySdk.builder().build() without incubator classes on the runtime classpath.