Instructions for installing the Lumigo tracer in a Node.js environment

This is @lumigo/tracer, Lumigo's Node.js agent for distributed tracing and performance monitoring.

Supported NodeJS runtimes: 8.10, 10.x, 12.x, 14.x


The @lumigo/tracer package allows you to pursue automated metric gathering through Lambda Layers, automated metric gathering and instrumentation through the Serverless framework, or manual metric creation and implementation.


Install the @lumigo/tracer package using NPM:

$ npm i @lumigo/tracer

Next, wrap your handler in Lumigo's trace function.

const lumigo = require('@lumigo/tracer')()

const myHandler = async (event, context, callback) => { ... }

exports.handler = lumigo.trace(myHandler)

Your function is now fully instrumented.

Finally, set your Lumigo token as the LUMIGO_TRACER_TOKEN environment variable of your Lambda function; refer to the Using AWS Lambda environment variables documentation for more information. Your Lumigo token is available in Settings -> Tracing -> Manual tracing.

We advise you to use the most secure available to you to store secrets such as your LUMIGO_TRACER_TOKEN; additionally, AWS provides integrations for AWS Key Management Service that keep the values of your Lambda environment variables secure.


@lumigo/tracer offers several different configuration options. Pass these to the Lambda function as environment variables:

  • LUMIGO_DEBUG=TRUE - Enables debug logging
  • LUMIGO_SECRET_MASKING_REGEX='["regex1", "regex2"]' - Prevents Lumigo from sending keys that match the supplied regular expressions. All regular expressions are case-insensitive. By default, Lumigo applies the following regular expressions:* [".pass.", ".key.", ".secret.", ".credential.", ".passphrase."].
  • LUMIGO_DOMAINS_SCRUBBER='[".secret."]' - Prevents Lumigo from collecting both request and response details from a list of domains. This accepts a comma-separated list of regular expressions that is JSON-formatted. By default, the tracer uses ["", "", ""]*. Note - These defaults are overridden when you define a different list of regular expressions.
  • LUMIGO_SWITCH_OFF=TRUE - In the event a critical issue arises, this turns off all actions that Lumigo takes in response to your code. This happens without a deployment, and is picked up on the next function run once the environment variable is present.

Did this page help you?