O'Reilly logo

TypeScript Microservices by Parth Ghiya

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Meter

This metric allows us to record when an event actually occurs and the number of occurrences of events per time unit. Calculating average is quite useful as it essentially gives us an idea about the load in the system. In this exercise, we will look at how to utilize meter metrics:

  1. Initialize project as usual. Install the pmx and pm2 dependency. It consists of the following keywords:
  • samples: This parameter corresponds to interval based on which we want to measure the metric. In our case, it is the number of calls per minute, hence 60.
  • timeframe: This is how long we want to hold the keymetrics data, the overall time frame over which it will be analyzed. Add the following code in the constructor to initialize meter metric dependency: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required