Skip to content
Lumigo's Node.js Distributed Tracing and Performance Agent
JavaScript Shell
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
__mocks__
auto-instrument-handler
example
layers
scripts
src
testUtils
.babelrc.js
.eslintrc.js
.gitignore
.npmignore
.prettierrc
LICENSE
README.md
commitlint.config.js
dist.test.js
jest.config.js
package-lock.json
package.json
webpack.config.js

README.md

lumigo-node 🌠

CircleCI codecov npm version License semantic-release

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

Usage

With Lambda Layers:

With Serverless framework:

Manually:

Install @lumigo/tracer:

npm:

$ npm i @lumigo/tracer

Wrap your handler (replace DEADBEEF with your token):

const lumigo = require('@lumigo/tracer')({ token: 'DEADBEEF' })

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

exports.handler = lumigo.trace(myHandler)

Configuration

  • You can turn on the debug logs by setting the environment variable LUMIGO_DEBUG=TRUE
  • You can prevent lumigo from sending keys that answer specific regexes by defining LUMIGO_SECRET_MASKING_REGEX=["regex1", "regex2"]. By default, we use the default regexes [".*pass.*", ".*key.*", ".*secret.*", ".*credential.*", ".*passphrase.*"]. All the regexes are case-insensitive.
  • Similarly, you can prevent lumigo from sending the entire headers and body of specific domains using the environment variable LUMIGO_DOMAINS_SCRUBBER=[".secret."] (give it a list which is a json parsable). By default, we will use ["secretsmanager...amazonaws.com", "ssm...amazonaws.com", "kms..*.amazonaws.com"]. Note that if you do specify a domains list - the default list will be overridden.
  • In case of need, there is a kill switch, that stops all the interventions of lumigo immediately, without changing the code. Simply add an environment variable LUMIGO_SWITCH_OFF=TRUE.

Step Functions

If this function is part of a step function, you can add the flag step_function or environment variable LUMIGO_STEP_FUNCTION=True, and we will track the states in the step function as a single transaction.

const lumigo = require('@lumigo/tracer')({ token: 'DEADBEEF', step_function: true })

Note: we will add the key "_lumigo" to the return value of the function.

If you override the "Parameters" configuration, simply add "_lumigo.$": "$._lumigo".
For example:

"States": {
    "state1": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:us-west-2:ACCOUNT:function:FUNCTION_NAME",
      "Parameters": {
          "Changed": "parameters",
          "_lumigo.$": "$._lumigo"
        },
      "Next": "state2"
    },
    "state2": {
      "Type": "pass",
      "End": true
    }
}

Logging Programmatic Errors

In order to log custom errors which will be visible in the platform, you can use console.log("[LUMIGO_LOG] <YOUR_MESSAGE>"); from anywhere in your lambda code.

You can’t perform that action at this time.