Search code examples
aws-lambdaaws-api-gatewayaws-xray

AWS X-Ray: Is it possible to add the API Gateway call to the service map?


I've added X-ray instrumentation to my lambda(Node.js) and can see all services around it in the trace, but still cannot add the API Gateway calling it to the trace and the service map. Is there anyway to do it?


Solution

  • According to the X-Ray FAQ, X-Ray only supports the following services: EC2, ECS, Lambda, and Elastic Beanstalk. Until X-Ray adds API Gateway support, you won't be able to trace API Gateway calls w/X-Ray.

    X-Ray docs say that metadata is added to AWS SDK calls made to AWS services, so you're seeing X-Ray trace data for other AWS services invoked by your Lambda function.

    This X-Ray documentation says that API Gateway doesn't send trace data to X-Ray, so you can't use a similar method to what X-Ray provides for AWS SDKs. For instance, if you used X-Ray's PutTraceSegments operation right before invoking your API Gateway API, you'd end up with two separate traces for each invocation. It looks like you'll have to wait for X-Ray and API Gateway to integrate. Hopefully that happens soon.