Skip to content

feat(sdk): propagate chained invoke trace context in START checkpoints - #957

Draft
zhongkechen wants to merge 28 commits into
mainfrom
feature/otel-propagation-groundwork-952
Draft

zhongkechen wants to merge 28 commits into
mainfrom
feature/otel-propagation-groundwork-952

Conversation

@zhongkechen

@zhongkechen zhongkechen commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

When a new context.invoke() START is checkpointed, the SDK now collects optional plugin metadata and writes the calling operation’s X-Ray header to flat ChainedInvokeOptions.XAmznTraceId. Each invoke in a batched checkpoint carries its own parent span. Existing function, tenant, payload, operation identity and persisted replay outcomes are preserved.

The optional synchronous hook uses readonly SDK-owned input/result types. The collector keeps the first supported nonblank value, warns on conflicting later values and isolates ordinary failures. Both OTel views encode canonical Root/Parent/Sampled, including Sampled=0, without creating an extra span. Checkpointed STARTs do not call the hook again; an uncommitted START may recompute on retry.

Keep this PR draft pending the Lambda model and backend rollout. The SDK implementation assumes the new model field exists, as required by the design. The pinned @aws-sdk/client-lambda 3.1014.0 lacks it: the unchanged wire-model parity guard fails type checking, and the actual generated serializer drops the field. The new serializer regression test intentionally exposes this dependency. After model publication, update/rebase and rerun normal build, installed-consumer, serialization and deployed trace-topology checks. No type suppression, serializer bypass, model gate or test skip is added.

Validation of this revision:

  • Core: 1,312 tests pass; the sole failing test is the actual Lambda serializer retaining the new field.
  • The 17 new public-wrapper tests cover identity, payload/tenant preservation, absence/error/blank fallback, batched child invokes, pending and terminal replay, and failed-checkpoint retry.
  • Both OTel views: 16 propagation tests pass against source, including sampled/unsampled public START paths and exact correspondence to exported calling spans. The supplemental source test configuration bypasses package-build setup only outside the repository; the normal test command is separately verified to stop at the model parity guard.
  • OTel type checking, root Biome and diff checks pass. Normal core build/declaration checks fail only at the model parity guard.

Existing registration APIs, provider API version and dependency floors remain unchanged. The declaration compatibility bridge from the earlier draft is retained; earlier released-package/layer checks are historical evidence and must be rerun after the model-dependent build is available. Integrate the coordinated minor PRs #956 and #955 before release. The separate #924 factory migration is not included. Shared CI prerequisite #959 remains in this branch.

The design also proposes DistributedMapOptions.XAmznTraceId; there is no corresponding distributed-map START API in this SDK. Existing map/parallel use CONTEXT operations, and this PR does not invent that future API or its model structures.

Refs #952; backend-dependent end-to-end delivery remains open. Coordinated SDK drafts: aws/aws-durable-execution-sdk-java#768 and aws/aws-durable-execution-sdk-python#755.

@zhongkechen zhongkechen changed the title feat(sdk): prepare chained-invoke propagation metadata feat(sdk): prepare SDK-owned propagation metadata contract Oct 3, 2026
Frank Chen and others added 3 commits October 3, 2026 04:58
Concurrent step retry wakeups may resume separately instead of coalescing into one invocation per attempt. Bound completed invocations by the initial invocation plus the six configured retry wakeups, retaining exact event signatures for every operation.

Also require three starts and failures per step, their original terminal errors, FAILED execution status, and a throwing result accessor. Validated on Node 24 with all promise examples and controlled 3/4/7-invocation delivery; the old assertion reproduces the CI failure with four invocations.
@zhongkechen zhongkechen changed the title feat(sdk): prepare SDK-owned propagation metadata contract feat(sdk): propagate chained invoke trace context in START checkpoints Oct 5, 2026

This branch has not been deployed

No deployments
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.

1 participant