Transaction Correlation through API-defined Exits

If you manually create an exit call for the Node.js Serverless Tracer, you need to locate the correlation header. This is required if your function does not use HTTP or inter-AWS Lambda exit calls.

The code snippet below demonstrates how you can create the correlation header:

module.exports.myLambdaHandler = function () {
// Start Exit Call
var exitCall = tracer.startExitCall({
// Fill in with the exit call information
});
//Get your correlation header
if (exitCall) {
var correlationHeader = tracer.createCorrelationInfo(exitCall);
}
/*
* Your exit call code.
* Pass the correlation header in the exit call for downstream correlation.
*/
// Stop the exit call
if (exitCall) {
tracer.stopExitCall(exitCall);
}
}