简体   繁体   中英

Using the same X-Ray Tracing-ID for multiple lambda functions

The Scenario is the following:

请求工作流

I have a lambda function that is listening to APIGateway and send the incoming request to two RabbitMQ queues. For each RabbitMQ queue, there is lambda listening and doing some work.
So I have now 3 lambda functions.

For start I can get the tracing-id from the first lambda and send it with message header to RabbitMQ but for the other lambda functions that are listening to RabbitMQ how can I configure them to use the same tracing-id?

Amazon MQ is not integrated with X-Ray, so it will not relay on any tracing headers automatically.

To trace requests that don't have a tracing header, you have to enable active tracing in the function configuration. This will set an immutable trace ID automatically for you.

You cannot overwrite this trace ID from within the Lambda function.

Unfortunately, there is no solution to this unless you specify your own segment using the X-Ray API or SDK with the trace ID manually set.

You could set the x-ray id from 1st lambda in a custom message header and manually create traces from the consumer 2nd and 3rd lambdas.

See: How can I create customized trace id for xray?

I'm not sure if it is possible to create events directly from a lambda to a custom xray id. If this is not possible the lambda could use SNS (or any other mean) to trigger the creation of the tracing event by some "tracing container" acting as middleware.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM