Add default constructor support for OTel plugin#540
Open
zhongkechen wants to merge 29 commits into
Open
Conversation
SilanHe
reviewed
Jul 14, 2026
SilanHe
left a comment
Contributor
There was a problem hiding this comment.
We'll have to add an integration test example where we use the optimized ADOT layer so that we can ensure this is working
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.
Summary
new OtelPlugin()for ADOT Java agent usage without handler-sideGlobalOpenTelemetryinitialization.OtelPluginAutoConfigurationCustomizerProviderthrough the OpenTelemetry Java agent autoconfigure SPI so the agent-createdSdkTracerProviderBuildergets the durable deterministicIdGeneratorbefore the provider is built.OtelPlugin()validate that the SPI ran, then useGlobalOpenTelemetry.getTracerProvider()directly instead of creating, copying, mutating, or reflecting into a provider.lib/and generate SAM config that pointsOTEL_JAVAAGENT_EXTENSIONS/otel.javaagent.extensionsat that jar for examples that usenew OtelPlugin().How It Works Now
/opt/otel-instrument./var/task/lib/aws-durable-execution-sdk-java-plugin-otel-<version>.jarfor no-arg OTel examples.META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider.OtelPluginAutoConfigurationCustomizerProviderinstalls a sharedDeterministicIdGeneratoron the agent SDK builder and marks installation through dependency-free shared state.OtelPlugin()checks that marker, uses the existing global tracer provider, and keeps a separateDeterministicIdGeneratorinstance only to publish durable execution state through system properties. The agent-installed generator reads that state when spans are started, which works across the app and agent classloader split.Why Not Reflection
ApplicationTracerProvider14, not a stable publicSdkTracerProviderBuildersurface.unobfuscate(), and internal fields such asagentTracerProviderare not consistently visible or typed from the application classloader.Testing
mvn -pl otel-plugin,examples spotless:applymvn -pl examples spotless:applypython3 generate-template.pymvn -pl otel-plugin -am testmvn -pl examples -am -Dtest="OtelXRayStepExampleTest,OtelXRayWaitExampleTest,OtelXRayExamplesTest" -Dsurefire.failIfNoSpecifiedTests=false testmvn -pl examples -am package -DskipTestslib/aws-durable-execution-sdk-java-plugin-otel-2.1.1-SNAPSHOT.jarand that nested jar contains the autoconfigure SPI service entry.