feat(otel): OtelPluginConfig parameter to replace constructor overloads for configuration options - #594
Open
SilanHe wants to merge 7 commits into
Open
feat(otel): OtelPluginConfig parameter to replace constructor overloads for configuration options#594SilanHe wants to merge 7 commits into
SilanHe wants to merge 7 commits into
Conversation
Both ExecutionOtelPlugin and InvocationOtelPlugin hardcoded the tracer's instrumentation scope name as "aws-durable-execution-sdk-java", unlike the JS (instrumentationName) and Python (instrument_name) plugins which expose it. Add a new fullest public constructor overload on each plugin that accepts an instrumentationName parameter; the existing 4-arg constructor delegates to it with the INSTRUMENTATION_NAME default (non-breaking). A null value falls back to the default. The no-arg ADOT constructor keeps the default (zero-config path); custom scope names are set via the builder constructors. No instance field is needed -- the scope name is only used at tracer creation (.get(...)), so it is resolved locally in the constructor. Tests: +1 per plugin asserting the exported spans' instrumentation scope name equals the custom value (Invocation 50, Execution 31). spotless clean.
SilanHe
requested a deployment
to
ai-pr-review-runtime
August 5, 2026 17:19 — with
GitHub Actions
Waiting
SilanHe
requested a deployment
to
ai-pr-review-runtime
August 5, 2026 17:19 — with
GitHub Actions
Waiting
zhongkechen
reviewed
Aug 5, 2026
SilanHe
marked this pull request as draft
August 5, 2026 17:26
…g builder Both InvocationOtelPlugin and ExecutionOtelPlugin used a chain of positional constructor overloads (up to 5 args). Adding each new knob (most recently instrumentationName) meant another overload on both plugins and increasingly ambiguous call sites (two String args, a boolean). This introduces an immutable OtelPluginConfig value object with a named-field builder and collapses the overloads to a single (SdkTracerProviderBuilder, OtelPluginConfig) constructor per plugin. - New OtelPluginConfig with builder: contextExtractor, enableMdc, workflowSpanName, instrumentationName (null-safe defaults). - Kept no-arg ADOT and single-builder convenience constructors; removed the 2/3/4/5-arg telescoping constructors. - Matches the OtelPluginConfig object in the JS and Python SDKs (cross-SDK parity) and is forward-compatible: future options are builder methods, not new constructors. - Migrated all test call sites and updated the README + examples docs. InvocationOtelPluginTest 50, ExecutionOtelPluginTest 31, integration 17, MdcSpanEnricherTest 3 all pass; examples compile; spotless clean.
Bring the Java plugins to full 3-tier parity with the JS and Python SDK plugins, resolved via config: - ProviderSource enum (EXPLICIT / GLOBAL / AUTO_OTLP) with an ownsProvider() helper; surfaced through OtelPluginConfig.resolveSource() and exposed on each plugin via providerSource(). - New (OtelPluginConfig) constructor on both plugins: when no builder is supplied it resolves GLOBAL (useDefaultTracerProvider=true) or, by default, AUTO_OTLP -- a plugin-owned SdkTracerProvider that exports over OTLP/HTTP (OtlpHttpSpanExporter + BatchSpanProcessor), with an env-driven sampler (OTEL_DURABLE_SAMPLING_RATIO) and Lambda resource attributes, mirroring JS/Python. - OtelPluginConfig gains useDefaultTracerProvider, otlpEndpoint and otlpHeaders builder options. - pom: add opentelemetry-exporter-otlp and move opentelemetry-sdk to compile scope so the auto path works without the ADOT agent. The no-arg constructor still uses the ADOT/global provider (unchanged); the builder constructors remain EXPLICIT. otel-plugin suite green (Invocation 53, Execution 33); spotless clean.
…rSource Replace the redundant useDefaultTracerProvider boolean and the derived resolveSource() with a single ProviderSource field on OtelPluginConfig (default AUTO_OTLP). Drop the now-dead ProviderSource.ownsProvider() helper. The config-only plugin constructors read config.providerSource() directly and reject EXPLICIT (which requires the (SdkTracerProviderBuilder, OtelPluginConfig) constructor).
SilanHe
marked this pull request as ready for review
August 6, 2026 00:03
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.
aws/aws-durable-execution-conformance-tests#23 (comment)
Replaces the OTel plugins' telescoping constructors with an immutable
OtelPluginConfigbuilder, adds a config-only constructor that auto-configures a plugin-owned OTLP/HTTP provider, and uses a singleProviderSourceenum (EXPLICIT/GLOBAL/AUTO_OTLP) to select the tracer provider. Breaking (preview API). All tests pass.