0.0.2 • Published 4 years ago

elastic-apm-express v0.0.2

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

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 ENVs 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 = require("elastic-apm-express");  

// Make sure it is after you done adding routes
elasticApmExpress(app);  

After this you would be able to see that your application is sending data to APM server. Enjoy your application monitoring.