Skip to content

[SVLS-8583] Add execution_status tag to aws.lambda span for durable functions#764

Merged
lym953 merged 4 commits intomainfrom
yiming.luo/durable-execution-status
Apr 16, 2026
Merged

[SVLS-8583] Add execution_status tag to aws.lambda span for durable functions#764
lym953 merged 4 commits intomainfrom
yiming.luo/durable-execution-status

Conversation

@lym953
Copy link
Copy Markdown
Contributor

@lym953 lym953 commented Apr 14, 2026

Summary

  • Adds aws_lambda.durable_function.execution_status tag to the aws.lambda span for durable function invocations
  • Tag is set from result.Status in the handler response; valid values are SUCCEEDED, FAILED, PENDING (matching the InvocationStatus enum in the durable execution SDK)
  • Applied whenever the event contains a DurableExecutionArn, independent of whether ARN parsing succeeds
  • Mirrors the implementation in the Python tracer: feat: add durable_function_execution_status tag to aws.lambda span datadog-lambda-python#751

Automated testing

  • Unit tests added for extractDurableExecutionStatus in durable-function-context.spec.ts covering all valid statuses, invalid status, missing status, null result, and non-durable events
  • Tests added in listener.spec.ts to verify the status tag is set when result.Status is valid and not set otherwise
  • All tests pass

Manual testing

Tested with a durable function which has 2 invocations in an execution.

The aws.lambda span for the 1st invocation has tag execution_status:PENDING (link)

image

For the 2nd invocation, the tag is execution_status:FAILED (link) or execution_status:SUCCEEDED (link)

image image

Note

Before an execution finishes (either fails or succeeds), the status is shown as RUNNING, even if the execution is paused. I'm planning to do the same on our UI, so the PENDING status won't be used, but still adding it as a tag because it's also informative as a tag itself.

Next steps

  1. Do the same thing for Python tracer. Right now Python tracer expects STOPPED and TIMED_OUT statuses (among others) from durable execution SDK, which is wrong. We should remove them and add PENDING.
  2. Build UI

🤖 Generated with Claude Code

lym953 and others added 2 commits April 14, 2026 16:39
…able functions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds durable-function execution status tagging to the aws.lambda span so downstream trace analysis can distinguish outcomes of durable function invocations.

Changes:

  • Add aws_lambda.durable_function.execution_status tag extraction based on result.Status for durable events.
  • Introduce extractDurableExecutionStatus helper with validation of allowed status values.
  • Add unit tests for extractDurableExecutionStatus.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/trace/listener.ts Sets the new durable execution status tag on the active aws.lambda span during invocation teardown.
src/trace/durable-function-context.ts Adds validated extraction of durable execution status from handler result.
src/trace/durable-function-context.spec.ts Adds test coverage for the new status-extraction helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/trace/listener.ts Outdated
Comment thread src/trace/listener.ts Outdated
Comment thread src/trace/durable-function-context.ts Outdated
lym953 and others added 2 commits April 14, 2026 23:04
…Status enum

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Use typeof string guard in extractDurableExecutionStatus for consistency
- Move execution_status tagging outside durableFunctionContext block so it
  applies even when ARN parsing fails
- Add listener.spec.ts tests for execution_status tag being set and not set

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lym953 lym953 marked this pull request as ready for review April 15, 2026 03:34
@lym953 lym953 requested review from a team as code owners April 15, 2026 03:34
Copy link
Copy Markdown
Contributor

@litianningdatadog litianningdatadog left a comment

Choose a reason for hiding this comment

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

Stamped. Please watch out the e2e failure

@lym953
Copy link
Copy Markdown
Contributor Author

lym953 commented Apr 16, 2026

E2E test deployment keeps failing with error ValidationError: Circular dependency between resources. Ignoring it and merging this PR.

@lym953 lym953 merged commit c9b398b into main Apr 16, 2026
41 of 42 checks passed
@lym953 lym953 deleted the yiming.luo/durable-execution-status branch April 16, 2026 14:07
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