Skip to content

Instantly share code, notes, and snippets.

@trmaphi
Last active January 7, 2021 03:53
Show Gist options
  • Save trmaphi/a45fa521868f0d57eea29712f359d3e0 to your computer and use it in GitHub Desktop.
Save trmaphi/a45fa521868f0d57eea29712f359d3e0 to your computer and use it in GitHub Desktop.
Setup X-ray on Lambda
/// Setup tracing in a separate file
import * as AWSXRay from 'aws-xray-sdk-core';
// Configure the context missing strategy to do nothing
// https://docs.aws.amazon.com/lambda/latest/dg/nodejs-tracing.html
AWSXRay.setContextMissingStrategy(() => { });
// https://github.com/aws/aws-xray-sdk-node/issues/143
AWSXRay.captureAWS(require('aws-sdk'));
/// Import tracing configuration on top of Lambda Handler
import './tracing';
// Your handler dependencies and implementation down here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment