Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sfn context injection skipped if no update on last step #1458

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

lym953
Copy link
Contributor

@lym953 lym953 commented Sep 16, 2024

Background

A Step Function can have multiple steps. Some steps may execute Lambda functions. Some steps may execute other Step Functions. When instrumenting a Step Function, we want to inject necessary context into both Lambda functions and child Step Functions.

Problem

If the last step doesn't need to be updated, e.g. if it's neither a Lambda function nor a Step Function, then context injection will be skipped. This is because the flag definitionHasBeenUpdated isn't updated properly.

What

Fix the usage of the flag so that if any part of definition is updated, this flag will be true.

Testing

Steps

  1. Create a State Machine where
    • the Lambda step is not instrumented
    • the last step doesn't need to be updated
  2. Instrument the Step Function by running datadog-ci stepfunctions instrument

Result

Before:

  • definitionHasBeenUpdated was false finally.
  • No change was applied.

After:

  • definitionHasBeenUpdated was true finally.
  • Changes were applied.

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)

@lym953 lym953 requested review from a team as code owners September 16, 2024 22:03
@lym953 lym953 added bug Something isn't working serverless Related to [lambda, stepfunctions, cloud-run] labels Sep 16, 2024
Copy link
Contributor

@avedmala avedmala left a comment

Choose a reason for hiding this comment

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

great fix! 🚢

@lym953 lym953 merged commit 620bb01 into master Sep 18, 2024
19 of 20 checks passed
@lym953 lym953 deleted the yiming.luo/fix-step-func-9 branch September 18, 2024 16:44
@lym953 lym953 changed the title fix: xfn context injection skipped if no update on last step fix: sfn context injection skipped if no update on last step Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working serverless Related to [lambda, stepfunctions, cloud-run]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants