Elastic APM Express
This is a wrapper for elastic-apm-node
for expressjs
.
The package silences the APM server connection errors to warnings.
It also makes it easy to be used as elastic apm egent for expressjs
applications.
Setup
Install
npm install --save elastic-apm-express
Add variable in '.env' file in root of your service
STORE_APP_NAME=your-app-name
ENV=production
ELASTIC_APM_SECRET_TOKEN=some_sekret
ELASTIC_APM_URL=http://localhost:8200
Other supported ENV
s are test, staging, development.
How to use
To add as middleware in express app
Add the below lines to the microservice's server file ("app" in the code is an implied reference to an instance of Express()):
const elasticApmExpress = ; // Make sure it is after you done adding routes;
After this you would be able to see that your application is sending data to APM server. Enjoy your application monitoring.