Repository navigation
fix: propagate context into handler workers #756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zhongkechen
wants to merge
22
commits into
main
Choose a base branch
from
fix/otel-handler-context-428
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
7d89a4e
fix: preserve handler worker context
0ea7ea2
test: classify handler dispatch unit coverage
95322ac
fix: bind missing handler trace context
zhongkechen 812f112
fix: confine handler context to worker scopes
370295f
test: retain published-core context expectations
e1f2cc9
test: isolate the published-core OTel environment
bdb6aca
test: pin legacy OTel compatibility coverage
687f8f0
ci: verify minimum-core OTel compatibility
zhongkechen d459e8e
test: cover OTel handler context scopes directly
7d7a1a3
fix: isolate invocation plugin context bindings
zhongkechen d62289f
fix: preserve uninstrumented worker context
zhongkechen df318b7
Merge branch 'main' into fix/otel-handler-context-428
zhongkechen 7f558a5
fix: isolate failed plugin context setup
zhongkechen b5cdeac
fix: require explicit handler scope opt-in
zhongkechen 40d9edf
fix: bind execution view in the handler worker
zhongkechen bd11d69
Merge commit 'refs/maintenance-python-20261006/base' into maintenance…
788011d
Merge commit 'refs/maintenance-python-20261006/base' into maintenance…
66f86d3
ci: route OTel conformance to CodeBuild
a028769
ci: preserve queued conformance runs
daae092
ci: adopt shared backend queue preservation
74c5486
fix: build new js example workspace dependencies
a421382
chore: merge main after telemetry view guard
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
72 changes: 72 additions & 0 deletions
72
.../aws-durable-execution-sdk-python-conformance-tests/tests/test_plugin_wait_replay_flag.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| """Concurrent plugin callbacks must emit separate parseable JSON records.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import importlib.util | ||
| import json | ||
| from concurrent.futures import ThreadPoolExecutor | ||
| from pathlib import Path | ||
| from threading import Event | ||
| from typing import Any | ||
|
|
||
| import pytest | ||
|
|
||
| import aws_durable_execution_sdk_python.execution as execution | ||
|
|
||
|
|
||
| def test_concurrent_wait_hooks_keep_complete_stdout_records( | ||
| monkeypatch: pytest.MonkeyPatch, | ||
| ) -> None: | ||
| # Import the real fixture without constructing a Lambda client: this test | ||
| # exercises its stdout producer, not a deployed durable invocation. | ||
| monkeypatch.setattr(execution, "durable_execution", lambda **_: lambda fn: fn) | ||
| path = ( | ||
| Path(__file__).resolve().parents[1] | ||
| / "handlers/plugin/plugin_wait_replay_flag.py" | ||
| ) | ||
| spec = importlib.util.spec_from_file_location("wait_replay_log_fixture", path) | ||
| assert spec is not None and spec.loader is not None | ||
| module = importlib.util.module_from_spec(spec) | ||
| spec.loader.exec_module(module) | ||
|
|
||
| first_body = Event() | ||
| second_ready = Event() | ||
| second_done = Event() | ||
| chunks: list[str] = [] | ||
|
|
||
| class FragmentingStdout: | ||
| def write(self, text: str) -> int: | ||
| chunks.append(text) | ||
| if '"operation-start"' in text: | ||
| first_body.set() | ||
| # print writes its body and newline separately. Permit the | ||
| # other real hook to run between them unless _emit serializes it. | ||
| second_done.wait(0.2) | ||
| return len(text) | ||
|
|
||
| def flush(self) -> None: | ||
| pass | ||
|
|
||
| records: list[dict[str, Any]] = [ | ||
| {"plugin": "CONFPLUGIN", "hook": "operation-start", "name": "long"}, | ||
| {"plugin": "CONFPLUGIN", "hook": "operation-end", "name": "short"}, | ||
| ] | ||
|
|
||
| def emit_end() -> None: | ||
| second_ready.set() | ||
| assert first_body.wait(2) | ||
| module._emit(records[1], "execution-arn") | ||
| second_done.set() | ||
|
|
||
| with monkeypatch.context() as capture: | ||
| capture.setattr("sys.stdout", FragmentingStdout()) | ||
| with ThreadPoolExecutor(max_workers=2) as executor: | ||
| end = executor.submit(emit_end) | ||
| assert second_ready.wait(2) | ||
| start = executor.submit(module._emit, records[0], "execution-arn") | ||
| start.result(timeout=2) | ||
| end.result(timeout=2) | ||
| actual = [json.loads(line) for line in "".join(chunks).splitlines() if line] | ||
| assert actual == [ | ||
| {"durableExecutionArn": "execution-arn", **record} for record in records | ||
| ] |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.