DataDog / datadog-ci

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

Refactor sfn Lambda injection code my merging two functions #1457

Closed lym953 closed 2 months ago

lym953 commented 2 months 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 2 months ago

Datadog Report

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

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