2

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?

Nicoowr
  • 770
  • 1
  • 10
  • 29

0 Answers0