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:
- 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: ...