Closed lym953 closed 2 months ago
This PR handles Step Function context injection into Lambda when Payload (not Payload.$) is used in the Lambda execution step.
Payload
Payload.$
This is case # 2 in this design doc: Fixing Step Function Instrumentation
Sub-cases:
"Lambda Invoke": { "Parameters": { "Payload": { "Execution.$": "$$.Execution", "State.$": "$$.State" }, }, },
Then just print a message.
If the payload already has any of Execution.$, Execution, State.$ or State, e.g.
Execution.$
Execution
State.$
State
"Lambda Invoke": { "Parameters": { "Payload": { "State": { "Name": 'Lambda Invoke' } }, }, },
and it's not case 2.1, then print a warning and skip context injection
i.e. it's not Case 2.1 or 2.2, e.g.
"Lambda Invoke": { "Parameters": { "Payload": { "CustomerId": 42 }, }, },
then just add the two fields:
"Lambda Invoke": { "Parameters": { "Payload": { "CustomerId": 42, "Execution.$": "$$.Execution", "State.$": "$$.State" }, }, },
Passed the added tests
Branch report: yiming.luo/fix-step-func-11 Commit report: 5120374 Test service: datadog-ci-tests
yiming.luo/fix-step-func-11
5120374
datadog-ci-tests
:white_check_mark: 0 Failed, 392 Passed, 0 Skipped, 1m 29.12s Total duration (2m 0.74s time saved)
What and why?
This PR handles Step Function context injection into Lambda when
Payload
(notPayload.$
) is used in the Lambda execution step.This is case # 2 in this design doc: Fixing Step Function Instrumentation
Sub-cases:
Case 2.1: Already instrumented
Then just print a message.
Case 2.2: Already has Execution or State field
If the payload already has any of
Execution.$
,Execution
,State.$
orState
, e.g.and it's not case 2.1, then print a warning and skip context injection
Case 2.3: no Execution or State field
i.e. it's not Case 2.1 or 2.2, e.g.
then just add the two fields:
Testing
Passed the added tests
Review checklist