Search code examples
amazon-web-services.net-coreaws-lambdaaws-xray

AWS X-Ray: how to propagate TraceId through Lambda --> SNS --> Lambda?


I have the following architecture:

API Gateway --> Lambda 1 --> SNS 1 --> Lambda 2 --> SNS 2 --> Lambda 3 (an Scatter-Gather pattern).

The TraceId is generated in API Gateway and propagated successfully to Lambda 1. My question is: how to pass that TraceId through SNS in order to reach Lambda 2? (propagating the TraceId through SNS 2 should be trivial once I've done this).

Lambda 1 is a .NET Core WEB API backend, and Lambda 2 and 3 are normal Lambdas listening for SNS messages


Solution

  • Unfortunately there is no workaround to continue the trace context from SNS to the triggered lambda2 or further workflow as you have described right now. This requires a change on SNS side to put the trace context when it invokes the target lambda function. We are already aware of this feature request and we are looking into a plan with SNS and Lambda team to provide better customer experience. Please stay tuned.

    Reference forum post : https://forums.aws.amazon.com/thread.jspa?messageID=874978󕧢