Skip to content

fix(otel): Python and TS Invocation handler uses default config - #66

Merged
SilanHe merged 7 commits into
mainfrom
fix/python-otel-invocation-config-constructor
Aug 7, 2026
Merged

fix(otel): Python and TS Invocation handler uses default config#66
SilanHe merged 7 commits into
mainfrom
fix/python-otel-invocation-config-constructor

Conversation

@SilanHe

@SilanHe SilanHe commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

The JS and Python SDK's InvocationOtelPlugin is being aligned to the Java default — auto-configure an OTLP provider when nothing is supplied, instead of defaulting to the global/ADOT provider (see aws/aws-durable-execution-sdk-python#612).

… handler

The Python SDK's InvocationOtelPlugin is being aligned to the JS default
(auto-configure an OTLP provider when nothing is supplied) instead of defaulting
to the global/ADOT provider (aws/aws-durable-execution-sdk-python#612). The
conformance harness relies on the global provider configured by the OTel
extension, so the Python handler must now request it explicitly -- matching the
TypeScript handler's InvocationOtelPlugin({ useDefaultTracerProvider: true }).

Update examples/python/src/common.py to construct
InvocationOtelPlugin(OtelPluginConfig(use_default_tracer_provider=True)), and
assert that constructor in test_python_examples.py.
The Python OTel SDK removed use_default_tracer_provider in favor of the
provider_source enum; GLOBAL is the equivalent of the old flag.
@SilanHe SilanHe reopened this Aug 6, 2026
SilanHe and others added 2 commits August 6, 2026 10:40
The JS OTel SDK removed useDefaultTracerProvider in favor of the
providerSource enum; Global is the equivalent of the old flag.
@SilanHe SilanHe changed the title fix(otel): Python Invocation handler passes use_default_tracer_provider=True fix(otel): Python and TS Invocation handler uses default config Aug 6, 2026
Both Python and TypeScript OTel examples now construct plugins with an
empty config and rely on the provider_source/providerSource default of
GLOBAL, instead of naming it explicitly.
@SilanHe
SilanHe marked this pull request as ready for review August 7, 2026 20:47
@SilanHe
SilanHe merged commit 237684e into main Aug 7, 2026
10 of 29 checks passed
@SilanHe
SilanHe deleted the fix/python-otel-invocation-config-constructor branch August 7, 2026 20:47
@SilanHe
SilanHe temporarily deployed to ai-pr-review-runtime August 7, 2026 20:48 — with GitHub Actions Inactive
@SilanHe
SilanHe temporarily deployed to ai-pr-review-runtime August 7, 2026 20:48 — with GitHub Actions Inactive
common = (EXAMPLES_DIR / "src" / "common.py").read_text(encoding="utf-8")
assert "ExecutionOtelPlugin" in common
assert "InvocationOtelPlugin" in common
assert "OtelPluginConfig()" in common

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex AI review

This assertion passes if either plugin uses OtelPluginConfig(). Reverting the invocation branch to InvocationOtelPlugin() would therefore leave the test green despite undoing this PR's behavior. Assert each complete constructor expression so both changed branches are covered.

Suggested change
assert "OtelPluginConfig()" in common
assert "ExecutionOtelPlugin(OtelPluginConfig())" in common
assert "InvocationOtelPlugin(OtelPluginConfig())" in common

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Codex AI review

Implementation is scoped, but the Python regression test does not specifically cover the changed constructors. Runtime compatibility still depends on upstream SDK integration tests.

Reviewed commit ee89308749386b2abd790c74330404de6ac05f16. Workflow run

process.env.OTEL_PLUGIN_MODE === "execution"
? new ExecutionOtelPlugin({ useDefaultTracerProvider: true })
: new InvocationOtelPlugin({ useDefaultTracerProvider: true });
? new ExecutionOtelPlugin({})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude AI review

This drops useDefaultTracerProvider: true from ExecutionOtelPlugin, but the PR title and description scope the change to the Invocation handler only (aligning InvocationOtelPlugin to the Java default). The Java reference has no ExecutionOtelPlugin at all, so "align to Java default" gives no justification for changing the execution view.

This also contradicts README.md (lines 213-215), which states the JS examples exercise both InvocationOtelPlugin and ExecutionOtelPlugin "with the tracer provider registered by the Lambda instrumentation layer." After this change the execution-view functions will auto-configure their own OTLP tracer provider instead of using the layer-registered/global provider, silently changing how execution-view telemetry is produced and exported (notably on the ADOT/X-Ray path).

Fix: if this is unintended, keep the change scoped to Invocation and restore new ExecutionOtelPlugin({ useDefaultTracerProvider: true }). If it is intended, state the execution-view change in the PR description and update the README statement so the documented behavior matches.

OtelPluginConfig(use_default_tracer_provider=True),
)
return InvocationOtelPlugin()
return ExecutionOtelPlugin(OtelPluginConfig())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude AI review

This removes use_default_tracer_provider=True from ExecutionOtelPlugin, which is the only substantive behavior change in this file: the adjacent InvocationOtelPlugin()InvocationOtelPlugin(OtelPluginConfig()) edit is cosmetic because the no-arg constructor already applied the default config. So despite the PR title/description scoping the change to the Invocation handler, the real functional change here is to the execution view — switching it from the default/global (ADOT) tracer provider to an auto-configured OTLP provider.

This change is unmentioned in the PR and mirrors the same out-of-scope switch flagged in the JavaScript handler. Fix: if unintended, restore ExecutionOtelPlugin(OtelPluginConfig(use_default_tracer_provider=True)) and keep the change limited to InvocationOtelPlugin; if intended, document the execution-view behavior change in the PR description.

common = (EXAMPLES_DIR / "src" / "common.py").read_text(encoding="utf-8")
assert "ExecutionOtelPlugin" in common
assert "InvocationOtelPlugin" in common
assert "OtelPluginConfig()" in common

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude AI review

This assertion is too weak to guard the behavior this PR changes. "OtelPluginConfig()" in common passes as long as either plugin uses an empty config, so it neither verifies that ExecutionOtelPlugin dropped use_default_tracer_provider=True nor that InvocationOtelPlugin now passes OtelPluginConfig(). A regression that reintroduced ExecutionOtelPlugin(OtelPluginConfig(use_default_tracer_provider=True)) while leaving the Invocation call untouched would still pass. The JavaScript contract test asserts the exact form for both plugins; mirror that here with exact-string checks.

Suggested change
assert "OtelPluginConfig()" in common
assert "ExecutionOtelPlugin(OtelPluginConfig())" in common
assert "InvocationOtelPlugin(OtelPluginConfig())" in common

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Claude AI review

This PR aligns the Python/JS OTel example handlers away from the default/global tracer provider. Per the PR title and description, the intended change is limited to InvocationOtelPlugin ("Python and TS Invocation handler uses default config" / "aligning InvocationOtelPlugin to the Java default"). However, the diff also removes the default-tracer-provider configuration from ExecutionOtelPlugin in both common.ts and common.py, which is outside the stated scope and contradicts README.md (lines 213-215), which documents both JS plugins as using "the tracer provider registered by the Lambda instrumentation layer."

Notably, for Python the InvocationOtelPlugin()InvocationOtelPlugin(OtelPluginConfig()) edit is effectively cosmetic (the no-arg constructor already applied the default config), so the only substantive behavior change in common.py is the removal of use_default_tracer_provider=True from ExecutionOtelPlugin — the opposite of what the description implies.

I could not verify the SDK-internal effect of this switch from this repo alone, so I cannot confirm it is a functional break. But the change to the execution view is real, unmentioned, and undocumented, and warrants author confirmation. The Python contract test was also not tightened to lock this down.

Residual test risk: the README statement about both plugins using the layer-registered provider is now stale for the JS execution view (README is not in this diff, so no inline comment). Neither test asserts the absence of useDefaultTracerProvider / use_default_tracer_provider=True on the execution plugin except via the JS exact-string checks; the Python test's "OtelPluginConfig()" in common substring check would still pass if the execution plugin regressed back to use_default_tracer_provider=True.

Reviewed commit ee89308749386b2abd790c74330404de6ac05f16. Workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants