Monitor the performance of your NodeJs app using Elastic APM

Soufiane Bouchaara
2 min readJun 11, 2020

To Monitor the performance of Stark, we will need the following stack:

APM Node.js Agent : sends performance metrics and errors to the APM Server. It has built-in support for the most popular frameworks and routers.

APM Server : receives data from APM agents and transforms them into Elasticsearch documents.

ElasticSearch: a database used for storing and indexing logs

Kibana: is a visualization tool (a web interface) that uses Elasticsearch DB to Explore, Visualize, and Share

The key features of implement an APM

Easy Implementation

The integration of APM with NodeJS — Express app is easy, and there are various ways we can tweak it to fit our needs.

The only updates we have to add to the coding, is a single call of the APM Agent to run it before everything else.

Example:

Performance of every web request and transaction

Using an APM will enable us to measure the performance of every web request and transaction in your application.

We can then use this to understand which requests are accessed the most, which are the slowest, and which ones you should add to your backlog to improve.

Code level performance profiling

By tracking what the application is doing all the way down to the code level, we can potentially gain more insights about what is occurring:

  • What key methods in your code are even being called?
  • Which methods are slow?
  • Is the app slow due to things like JIT, garbage collection, etc?
  • What dependencies are being called?

Application errors

We need to find and fix the errors, or at least know about them, before or customers call to tell us because odds are most of them won’t even call to tell you.

We can set up alerts for new exceptions as well as for monitoring overall error rates.

Here are some screenshots of a Kibana Dashboard Connected with Elastic APM

--

--