Tracing Distributed Map States
このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、
お気軽にご連絡ください。
In AWS Step Functions, you can set up a large-scale parallel workload by including a Map
state in Distributed mode. Datadog supports tracing your Distributed Map states.
Set up trace merging
To ensure that child workflows are correctly linked to their parents, enable the Item Batching option for your Distributed Map state. For more information, see ItemBatcher. If you don’t want to use Item Batching, you can set MaxItemsPerBatch
to 1 as a workaround.
Your State Machine definition must use JSONata as the query language. To enable this, set your definition’s top-level QueryLanguage
field to JSONata
.
On the Distributed Map state, set _datadog
in the BatchInput
field as follows:
"ItemBatcher": {
"MaxItemsPerBatch": N,
"BatchInput": {
"_datadog": "{% ($execInput := $states.context.Execution.Input; $hasDatadogTraceId := $exists($execInput._datadog.`x-datadog-trace-id`); $hasDatadogRootExecutionId := $exists($execInput._datadog.RootExecutionId); $ddTraceContext := $hasDatadogTraceId ? {'x-datadog-trace-id': $execInput._datadog.`x-datadog-trace-id`, 'x-datadog-tags': $execInput._datadog.`x-datadog-tags`} : {'RootExecutionId': $hasDatadogRootExecutionId ? $execInput._datadog.RootExecutionId : $states.context.Execution.Id}; $merge([$ddTraceContext, {'serverless-version': 'v1', 'timestamp': $millis()}])) %}"
}
}
Limitations
Executions from a child map run are in the same invocation table as the parent Step Function. As a result, the child table in the Step Functions page is empty.
Troubleshooting
If trace merging is broken because there is another upstream service, ensure the upstream setup is correct according to the Step Function Trace Merging documentation.