Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to chain lambda function calls in X-Ray service map

I would like to chain two lambda function calls in the xray service map to visualize the connections between the function calls and get the overall execution time. My lambda functions are being called by step functions. When enabling active tracing I see the individual functions in the service map but there is no connections between them.

_X_AMZN_TRACE_ID: Contains the tracing header, which includes the sampling decision, trace ID, and parent segment ID. (To learn more about these properties, see Tracing Header.) If Lambda receives a tracing header when your function is invoked, that header will be used to populate the _X_AMZN_TRACE_ID environment variable. If a tracing header was not received, Lambda will generate one for you.

https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html

_X_AMZN_TRACE_ID seems to contain the relevant information. My question is, how can I use it to establish a connection between two lambda function calls (being called by step functions)?

like image 791
lenawal Avatar asked Mar 11 '19 11:03

lenawal


2 Answers

Step Functions X-Ray trace context propagation isn’t yet supported so there isn’t a way to chain your lambda functions together if they are being called by Step Functions. We are working on this feature but don’t currently have an ETA.

like image 188
Steven Roach Avatar answered Nov 15 '22 03:11

Steven Roach


X-Ray integration is added to AWS Step Function: https://aws.amazon.com/blogs/compute/introducing-aws-x-ray-new-integration-with-aws-step-functions/

You can enable X-Ray tracing when creating a new state machine by selecting Enable X-Ray tracing on the Specify details page. In the case that state machine gets call from upper service with X-Ray enabled, state machine automatically continue the trace. And for all Task states in state machine, subsegments will be added tp the trace.

like image 42
Pooya Paridel Avatar answered Nov 15 '22 05:11

Pooya Paridel