feat(sdk): emit operationName in default logger output#692
Merged
Conversation
yaythomas
previously approved these changes
Jul 6, 2026
yaythomas
left a comment
Contributor
There was a problem hiding this comment.
- All production call sites of runWithContext are covered. There are 5 in src/ (not counting tests): step-handler.ts:326, wait-for-condition-handler.ts:255, and two in run-in-child-context-handler.ts (the ReplayChildren replay path at :260 and executeChildContext at :384) all now pass the operation name. The fifth, with-durable-execution.ts:123, is the root context ("root", no name) and is correctly left untouched. No operation path that runs customer code in a tracked context was missed.
- operationName is the human-readable name, operationId stays hashed (hashId(contextId)). Good — they carry different information and the test (operationName: "fetch-user" alongside a hashed operationId) confirms it.
- Root is doubly-guarded. getDurableLogData in packages/aws-durable-execution-sdk-js/src/context/durable-context/durable-context.ts requires contextId !== "root" before emitting, and the root call site passes no name anyway.
- Field ordering matches the order-sensitive tests. formatDurableLogData in packages/aws-durable-execution-sdk-js/src/utils/logger/default-logger.ts inserts operationName between operationId and attempt, matching both the DurableLogData interface order and the exact JSON.stringify assertions in default-logger.test.ts.
- Typechecks cleanly. DefaultDurableLogEntry extends DurableLogData, so adding the optional field to packages/aws-durable-execution-sdk-js/src/types/logger.ts is enough for result.operationName = … to type.
The default logger emitted requestId, executionArn, tenantId, operationId, and attempt, but never operationName. This diverged from the documented log format and from the Python and Java SDKs, which both emit operationName. Thread the operation/step/child-context name through the async-local context tracker (runWithContext) and surface it via getDurableLogData so the default logger includes operationName when available. It is derived from the operation name (like the Java SDK) and is omitted for the root context and when no name is present, keeping the change backward-compatible. - context-tracker: add operationName to ContextInfo and runWithContext - step, wait-for-condition, and run-in-child-context handlers pass the name - DurableLogData: add optional operationName field - durable-context: populate operationName in getDurableLogData (omit at root) - default-logger: emit operationName when present - add unit/integration tests; update runWithContext argument assertions Refs: TT V2276912870
The logger-log-levels example acts as an integration test that asserts the exact structured log output. Now that the default logger emits operationName for named steps and child contexts, update the expectations to include it wherever operationId is present. Refs: TT V2276912870
ParidelPooya
force-pushed
the
feat/sdk-logger-operation-name
branch
from
July 6, 2026 18:43
a18e6ab to
051212f
Compare
yaythomas
approved these changes
Jul 6, 2026
ParidelPooya
marked this pull request as ready for review
July 6, 2026 19:01
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.
The default logger emitted requestId, executionArn, tenantId, operationId, and attempt, but never operationName. This diverged from the documented log format and from the Python and Java SDKs, which both emit operationName.
Thread the operation/step/child-context name through the async-local context tracker (runWithContext) and surface it via getDurableLogData so the default logger includes operationName when available. It is derived from the operation name (like the Java SDK) and is omitted for the root context and when no name is present, keeping the change backward-compatible.