refactor(otel): resolve provider source via enum - #792
Merged
Conversation
Resolve the tracer provider once into an explicit ProviderSource (Explicit / Global / AutoOtlp) and carry it on ProviderResult, instead of re-deriving the decision from config in two places. registerStandaloneInstrumentations now switches on the resolved ProviderSource rather than recomputing it from (config.tracerProvider, config.useDefaultTracerProvider): - Explicit -> skip all instrumentation (caller owns it) - Global -> AWS SDK instrumentation only - AutoOtlp -> AWS SDK + HTTP (unless enableHttpInstrumentation=false) ownsProvider remains on ProviderResult (derived: true only for AutoOtlp). Behavior is unchanged; this mirrors the Python refactor for cross-SDK symmetry. 194/194 otel tests pass; build clean.
SilanHe
requested a deployment
to
ai-pr-review-runtime
August 5, 2026 22:09 — with
GitHub Actions
Waiting
SilanHe
requested a deployment
to
ai-pr-review-runtime
August 5, 2026 22:09 — with
GitHub Actions
Waiting
…ignal ProviderResult.source (ProviderSource enum) is now the single source of truth for provider tier/ownership. The ownsProvider boolean was a pure projection of source === AutoOtlp and was read by no production code (the ExecutionOtelPlugin field was write-only). Removes it from ProviderResult and the plugin, and switches the provider-resolution tests to assert on source. 194/194 otel tests pass; tsc --noEmit + build clean.
…iderSource Move the ProviderSource enum into the config module and add a single resolveProviderSource(config) resolver that owns the precedence chain (explicit tracerProvider > useDefaultTracerProvider > auto-OTLP). - createTracerProvider now resolves the source once and switches on it, instead of re-deriving the tiers from raw config booleans inline. - ExecutionOtelPlugin stores providerSource and gates the child Invocation span on 'source !== Global' (was '!useDefaultTracerProvider'). - InvocationOtelPlugin drops its write-only useDefaultTracerProvider field. - provider.ts re-exports ProviderSource so existing import sites are stable. No behavior change. 194/194 otel tests pass; tsc --noEmit + build clean.
…erSource enum BREAKING CHANGE: OtelPluginConfig no longer accepts `useDefaultTracerProvider`. Provider mode is now selected via the fully enum-driven `providerSource` (ProviderSource.AutoOtlp default | Global | Explicit). - providerSource is the sole selector; tracerProvider is a companion input consumed only by Explicit. resolveProviderSource now validates the coupling: Explicit requires tracerProvider (throws if missing), and tracerProvider is rejected for any non-Explicit source (throws) instead of being silently ignored. - ProviderSource is now exported publicly from index.ts. - Migrated all examples, the shared test setup, 6 test files, and the README. Explicit-provider call sites now pass providerSource: ProviderSource.Explicit; ADOT/global sites pass ProviderSource.Global. 198/198 otel tests pass; tsc --noEmit + build clean; examples codegen + tsc --noEmit clean.
BREAKING CHANGE: the default provider mode changes from AutoOtlp to Global. A no-config plugin now uses the globally registered provider (trace.getTracerProvider()) instead of building its own OTLP exporter. If no global provider is registered, OTel returns a no-op provider and no spans are exported — callers who relied on zero-config local OTLP export must now set providerSource: ProviderSource.AutoOtlp explicitly. - resolveProviderSource defaults to ProviderSource.Global. - Pinned the sites that depend on auto-OTLP behavior to explicit AutoOtlp: the community-collector execution/invocation cloud-mode examples and the 'creates its own internal provider' unit test. - Updated the resolution tests (absent/empty config now resolves to Global) and the README (modes list, deployment matrix, config docs). 197/197 otel tests pass; tsc --noEmit + build clean; examples codegen + tsc --noEmit clean.
The factory doc still implied AutoOtlp was the fallback/default. Rewrote it to describe all three ProviderSource tiers with Global as the default.
Rename ProviderSource members from PascalCase (Explicit/Global/AutoOtlp) to SCREAMING_SNAKE_CASE (EXPLICIT/GLOBAL/AUTO_OTLP), matching the Python and Java SDK enums. String values are unchanged. Updated all references, tests, examples, and README.
SilanHe
marked this pull request as ready for review
August 7, 2026 20:12
zhongkechen
approved these changes
Aug 7, 2026
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
useDefaultTracerProviderand the derivedownsProviderwith a singleProviderSourceenum (GLOBAL|AUTO_OTLP|EXPLICIT), owned by the config and validated centrally.The default ProviderSource is "GLOBAL" which will fetch the active provider user the getDefaultProvider() function.