Simple code execution monitoring for NodeJs backend applications.
Install the latest version via npm:
npm install @inspector-apm/inspector-nodejs --save
You need an Ingestion Key to create an Inspector instance. You can obtain a key creating a new project in your dashboard.
If you use dotenv
you can configure the Ingestion Key in your environment file:
INSPECTOR_INGESTION_KEY=[ingestion key]
Inspector must be initialized before you require any other modules - i.e. before, express
, http
, mysql
, etc.
/*
* 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.use(inspector.expressMiddleware())
app.get('/', function (req, res) {
return res.send('Home Page!')
})
app.get('/posts/:id', function (req, res) {
return res.send('Single Post Details!')
})
app.listen(3006)
Inspector will monitor your code execution in real time, alerting you if something goes wrong.
Go to the official documentation
We encourage you to contribute to Inspector! Please check out the Contribution Guidelines about how to proceed. Join us!
This package is licensed under the MIT license.