Install

Customize the module behaviour.

Install

Install the latest version using the npm command below:

npm install @inspector-apm/inspector-nodejs --save

Configure the Ingestion Key

You need an Ingestion Key to create an Inspector instance. You can obtain a key creating a new project in your Inspector dashboard.

If you use dotenv you can configure the Inspector Ingestion Key in your environment file:

INSPECTOR_INGESTION_KEY=[ingestion key]

Initialization

Initialize Inspector before you require any other modules in your application - i.e. before express, http, mysql, etc.

const inspector = require(@inspector-apm/inspector-nodejs)({
ingestionKey: 'xxxxx'
})

Here are the list of the others parameters that you can use to customize the behaviour of inspector.

enable (boolean)

If desired, you may disable data transfer setting to false the enable configuration option. It could be useful if need to turn on/off monitoring via enviroment files.

{
ingestionKey: 'xxxxx',
enabled: process.env.INSPECTOR_ENABLED||true
}

maxEntries (integer)

Max numebr of items recorded during an execution cycle. 100 by default.

{
ingestionKey: 'xxxxx',
maxEntries: process.env.INSPECTOR_MAX_ENTRIES||500
}

autoWiring (boolean)

By default Inspector automatically detect the modules required in your application to monitoring their interactions.

You can turn off the auto-wiring and set the list of the module to be monitored manually in the "modules" configuration option.

{
ingestionKey: 'xxxxx',
autoWiring: false,
node_modules: [...]
}

modules (Array)

The list of the module that you want take in consideration for your monitoring needs.

{
ingestionKey: 'xxxxx',
autoWiring: false,
node_modules: ['express', 'mysql2', 'mongodb']
}