DataDog / datadog-ci

Use Datadog from your CI.
https://datadoghq.com
Apache License 2.0
127 stars 54 forks source link

Refactor sfn Lambda injection code my merging two functions #1459

Closed lym953 closed 1 week ago

lym953 commented 1 week ago

What

Currently the injectContextForLambdaFunctions() function roughly looks like this:

const injectContextForLambdaFunctions = (...): boolean => {
  if (shouldUpdateStepForTracesMerging()) {
    addTraceContextToLambdaParameters()
    return true
  }
  return false
}

It calls shouldUpdateStepForTracesMerging().

This PR merges the two functions by moving the code of shouldUpdateStepForTracesMerging() into injectContextForLambdaFunctions().

Why?

We will soon have different instrumentation strategies depending on the existing state of Lambda definition, so shouldUpdateStepForTracesMerging() which has a boolean return value will no longer work.

Design doc: Fixing Step Function Instrumentation A short description of what changes this PR introduces and why.

Testing

Passed the touched automated tests

Review checklist

datadog-datadog-prod-us1[bot] commented 1 week ago

Datadog Report

Branch report: yiming.luo/fix-step-func-7 Commit report: b3d62f4 Test service: datadog-ci-tests

:white_check_mark: 0 Failed, 376 Passed, 0 Skipped, 1m 26.56s Total duration (2m 2.32s time saved)