2 years ago

#65326

test-img

Nicoowr

AWS X-Ray - Lambda invoked by another lambda does not use parent traceID

I want to use AWS X-Ray with Apollo Federation. The Apollo Gateway is hosted on AWS Lambda and it calls subservices which are also hosted on AWS Lambda.

I activated tracing for every lambda (gateway & subservices) in serverless.yml:

    tracing: {
      apiGateway: true,
      lambda: true,
    }

And I instrumented every lambda to capture HTTPs calls globally:

const AWSXRay = require("aws-xray-sdk");

AWSXRay.captureHTTPsGlobal(require("https"));

The traces for gateway and subservices work well. Below is the gateway trace and subservice trace: enter image description here

enter image description here

However, it seems the subservice traces use a different traceID even though the header x-amzn-trace-id is correctly passed from the gateway to the subservice: enter image description here

The picture above is a screenshot of cloudwatch logs of one subservice. The header x-amzn-trace-id is correctly passed from the gateway (1st & 2nd red rectangles), but it is different from the traceId used for the lambda (rectangle at the bottom). Hence, both traces cannot be gathered together.

Am I missing something here?

aws-lambda

trace

aws-xray

apollo-federation

0 Answers

Your Answer

Accepted video resources