Skip to content

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

Merged
lym953 merged 4 commits into
mainfrom
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 into
mainfrom
yiming.luo/durable-execution-status

Conversation

@lym953

@lym953lym953 commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

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)

imageimage

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

lym953and 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>

CopilotAI left a comment

Copy link
Copy Markdown

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.

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

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

Comment threadsrc/trace/listener.ts Outdated
Comment threadsrc/trace/listener.ts Outdated
Comment threadsrc/trace/durable-function-context.ts Outdated
lym953and 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 ownersApril 15, 2026 03:34

@litianningdatadoglitianningdatadog left a comment

Copy link
Copy Markdown
Contributor

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
ContributorAuthor

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

@lym953
lym953 merged commit c9b398b into mainApr 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 freeto 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

@lym953@litianningdatadog