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:
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:
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?