Code Execution Monitoring for Express applications.


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:



To monitor your application code execution you need to do just two things:

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

  2. Attach the expressMiddleware() to your express app.

/* -------------------------------------------
* Initialize Inspector with the Ingestion Key.
--------------------------------------------- */
const inspector = require('@inspector-apm/inspector-nodejs')({
ingestionKey: 'xxxxxxxxxxxxx',
const app = require('express')()
/* ----------------------------------------------
* Attach the middleware to monitor HTTP requests fulfillment.
------------------------------------------------ */
app.get('/', function (req, res) {
return res.send('Home Page!')
app.get('/posts/:id', function (req, res) {
return res.send('Single Post Details!')

Exclude paths

If you want to turn off monitoring in some parts of your application you can pass a JSON object to the expressMiddleware function with excludePaths property to define in which routes you want to disable monitoring:

excludePaths: [