Book Image

Mastering Web Application Development with Express

By : Alexandru Vladutu
Book Image

Mastering Web Application Development with Express

By: Alexandru Vladutu

Overview of this book

Table of Contents (18 chapters)
Mastering Web Application Development with Express
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Collecting metrics


There are commercial services that take care of gathering as much data as possible from our Express applications, from process metrics to operating system metrics, and so on. We can choose to use such a service, or we can collect data on our own.

However, we will next focus on gathering data from our applications and creating a dashboard with real-time charts.

Among the metrics, we will collect the following parameters:

  • Requests per second

  • Response time

  • CPU usage

  • Event loop delay

  • Memory usage

  • OS load average

The dashboard will look like in the following screenshot once we're done implementing everything:

For this application, we will use the usage module to get the CPU usage and the measured module for collecting measurements.

The timer functionality from the measured module also uses the same high-resolution time-tracking technique that we used earlier in this chapter to get the elapsed time between two moments.

First, we will begin by listing the dependencies and initializing variables...