fix(aws-durable-execution-sdk-js): [SVLS-8588] set span type to serverless#9162
Conversation
A durable operation served from a FAILED checkpoint on replay (the SDK re-raises the stored error without running the body) was not recognized as a replay: both `aws.durable.replayed` and the `aws.durable.operation_attempt` normalization keyed only on `Status === 'SUCCEEDED'`. As a result a caught-then-replayed failed operation reported `replayed=false` and a 1-indexed `operation_attempt` (e.g. 2 for a step whose 2nd attempt failed) — one higher than, and inconsistent with, the live final attempt (1). This is the same off-by-one #8595 fixed for SUCCEEDED, still open for FAILED. Treat a terminal checkpoint (SUCCEEDED or FAILED) as a replay for both tags, so the replay agrees with the live run (replayed=true, operation_attempt=1). Verified in production on a durable Lambda. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The durable plugins declare `static type = 'serverless'`, but `TracingPlugin.startSpan` only defaults `component` from the class — `type` and `kind` have no `this.constructor.*` fallback. The plugins forwarded `kind: this.constructor.kind` but omitted `type`, so every durable span was emitted with an empty `span.type`. Forward `type: this.constructor.type` in both bindStart calls so the spans carry `type: serverless`, matching the dd-trace-py integration. This lets serverless UIs (e.g. the Lambda trace panel's Durable Function Execution section) recognize the spans as Lambda/function spans. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Overall package sizeSelf size: 6.55 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.0 | 117.14 kB | 432.47 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 49cc577 | Docs | Datadog PR Page | Give us feedback! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9162 +/- ##
==========================================
- Coverage 93.59% 93.59% -0.01%
==========================================
Files 900 900
Lines 52679 52679
Branches 12405 12405
==========================================
- Hits 49306 49305 -1
- Misses 3373 3374 +1 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
BenchmarksBenchmark execution time: 2026-07-06 16:11:38 Comparing candidate commit 49cc577 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 2247 metrics, 39 unstable metrics.
|
There was a problem hiding this comment.
Pull request overview
Fixes aws-durable-execution-sdk-js integration spans emitting an empty span.type by forwarding the plugin-declared type (serverless) into span creation, aligning behavior with other tracers and restoring Infra tab content for durable execution spans.
Changes:
- Forward
type: this.constructor.typeintostartSpan()for both execute spans (handler.js) and operation spans (context.js). - Normalize replay detection / attempt normalization to treat
FAILEDcheckpoints likeSUCCEEDEDcheckpoints (util.js). - Add integration test coverage asserting
span.type === 'serverless'and add a regression test for replayed permanently-failed step attempt normalization (index.spec.js).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/datadog-plugin-aws-durable-execution-sdk-js/src/handler.js | Passes plugin static type into the execute span start options so span.type is set. |
| packages/datadog-plugin-aws-durable-execution-sdk-js/src/context.js | Passes plugin static type into operation span start options so child spans get span.type. |
| packages/datadog-plugin-aws-durable-execution-sdk-js/src/util.js | Treats FAILED checkpoints as replay terminal states for replayed tagging and attempt normalization. |
| packages/datadog-plugin-aws-durable-execution-sdk-js/test/index.spec.js | Adds assertions for span.type = serverless and a regression test for replayed FAILED checkpoint attempt normalization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…rless (#9162) * fix(aws-durable-execution-sdk-js): treat FAILED checkpoints as replays A durable operation served from a FAILED checkpoint on replay (the SDK re-raises the stored error without running the body) was not recognized as a replay: both `aws.durable.replayed` and the `aws.durable.operation_attempt` normalization keyed only on `Status === 'SUCCEEDED'`. As a result a caught-then-replayed failed operation reported `replayed=false` and a 1-indexed `operation_attempt` (e.g. 2 for a step whose 2nd attempt failed) — one higher than, and inconsistent with, the live final attempt (1). This is the same off-by-one #8595 fixed for SUCCEEDED, still open for FAILED. Treat a terminal checkpoint (SUCCEEDED or FAILED) as a replay for both tags, so the replay agrees with the live run (replayed=true, operation_attempt=1). Verified in production on a durable Lambda. Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(aws-durable-execution-sdk-js): set span type to serverless The durable plugins declare `static type = 'serverless'`, but `TracingPlugin.startSpan` only defaults `component` from the class — `type` and `kind` have no `this.constructor.*` fallback. The plugins forwarded `kind: this.constructor.kind` but omitted `type`, so every durable span was emitted with an empty `span.type`. Forward `type: this.constructor.type` in both bindStart calls so the spans carry `type: serverless`, matching the dd-trace-py integration. This lets serverless UIs (e.g. the Lambda trace panel's Durable Function Execution section) recognize the spans as Lambda/function spans. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
…rless (#9162) * fix(aws-durable-execution-sdk-js): treat FAILED checkpoints as replays A durable operation served from a FAILED checkpoint on replay (the SDK re-raises the stored error without running the body) was not recognized as a replay: both `aws.durable.replayed` and the `aws.durable.operation_attempt` normalization keyed only on `Status === 'SUCCEEDED'`. As a result a caught-then-replayed failed operation reported `replayed=false` and a 1-indexed `operation_attempt` (e.g. 2 for a step whose 2nd attempt failed) — one higher than, and inconsistent with, the live final attempt (1). This is the same off-by-one #8595 fixed for SUCCEEDED, still open for FAILED. Treat a terminal checkpoint (SUCCEEDED or FAILED) as a replay for both tags, so the replay agrees with the live run (replayed=true, operation_attempt=1). Verified in production on a durable Lambda. Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(aws-durable-execution-sdk-js): set span type to serverless The durable plugins declare `static type = 'serverless'`, but `TracingPlugin.startSpan` only defaults `component` from the class — `type` and `kind` have no `this.constructor.*` fallback. The plugins forwarded `kind: this.constructor.kind` but omitted `type`, so every durable span was emitted with an empty `span.type`. Forward `type: this.constructor.type` in both bindStart calls so the spans carry `type: serverless`, matching the dd-trace-py integration. This lets serverless UIs (e.g. the Lambda trace panel's Durable Function Execution section) recognize the spans as Lambda/function spans. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
…rless (#9162) * fix(aws-durable-execution-sdk-js): treat FAILED checkpoints as replays A durable operation served from a FAILED checkpoint on replay (the SDK re-raises the stored error without running the body) was not recognized as a replay: both `aws.durable.replayed` and the `aws.durable.operation_attempt` normalization keyed only on `Status === 'SUCCEEDED'`. As a result a caught-then-replayed failed operation reported `replayed=false` and a 1-indexed `operation_attempt` (e.g. 2 for a step whose 2nd attempt failed) — one higher than, and inconsistent with, the live final attempt (1). This is the same off-by-one #8595 fixed for SUCCEEDED, still open for FAILED. Treat a terminal checkpoint (SUCCEEDED or FAILED) as a replay for both tags, so the replay agrees with the live run (replayed=true, operation_attempt=1). Verified in production on a durable Lambda. Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(aws-durable-execution-sdk-js): set span type to serverless The durable plugins declare `static type = 'serverless'`, but `TracingPlugin.startSpan` only defaults `component` from the class — `type` and `kind` have no `this.constructor.*` fallback. The plugins forwarded `kind: this.constructor.kind` but omitted `type`, so every durable span was emitted with an empty `span.type`. Forward `type: this.constructor.type` in both bindStart calls so the spans carry `type: serverless`, matching the dd-trace-py integration. This lets serverless UIs (e.g. the Lambda trace panel's Durable Function Execution section) recognize the spans as Lambda/function spans. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
…rless (#9162) * fix(aws-durable-execution-sdk-js): treat FAILED checkpoints as replays A durable operation served from a FAILED checkpoint on replay (the SDK re-raises the stored error without running the body) was not recognized as a replay: both `aws.durable.replayed` and the `aws.durable.operation_attempt` normalization keyed only on `Status === 'SUCCEEDED'`. As a result a caught-then-replayed failed operation reported `replayed=false` and a 1-indexed `operation_attempt` (e.g. 2 for a step whose 2nd attempt failed) — one higher than, and inconsistent with, the live final attempt (1). This is the same off-by-one #8595 fixed for SUCCEEDED, still open for FAILED. Treat a terminal checkpoint (SUCCEEDED or FAILED) as a replay for both tags, so the replay agrees with the live run (replayed=true, operation_attempt=1). Verified in production on a durable Lambda. Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(aws-durable-execution-sdk-js): set span type to serverless The durable plugins declare `static type = 'serverless'`, but `TracingPlugin.startSpan` only defaults `component` from the class — `type` and `kind` have no `this.constructor.*` fallback. The plugins forwarded `kind: this.constructor.kind` but omitted `type`, so every durable span was emitted with an empty `span.type`. Forward `type: this.constructor.type` in both bindStart calls so the spans carry `type: serverless`, matching the dd-trace-py integration. This lets serverless UIs (e.g. the Lambda trace panel's Durable Function Execution section) recognize the spans as Lambda/function spans. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
Problem
Durable execution spans (
aws.durable.execute,aws.durable.step,aws.durable.wait, etc.) emitted by the JS integration carry an emptyspan.type, whereas the equivalentdd-trace-pyspans are typedserverless.The plugins already declare the intended type:
but it never reached the span.
As a result, on traces view, when the active span is a durable function span such as
aws.durable.executeoraws.durable.step, the Infrastructure tab is empty because this tab relies ontypeto display content.Fix
Forward
type: this.constructor.typealongside the existingkindin bothbindStartcalls (context.js,handler.js).Test
Now the Infrastructure tab shows content as expected.
