RuntimeTools / appmetrics

Node Application Metrics provides a foundational infrastructure for collecting resource and performance monitoring data for Node.js-based applications.
https://developer.ibm.com/open/node-application-metrics/
Apache License 2.0
977 stars 126 forks source link

Question: why 'loop' event is occur by 4 seconds and 6 seconds, not 5 seconds #603

Open yuecchen opened 5 years ago

yuecchen commented 5 years ago

I add the following lines in the top of application:

var appmetrics=require('appmetrics');
var monitor = appmetrics.monitor();
monitor.on('loop', function(data){console.info('timestamp:',new Date());});

And I will got the following logs:

timestamp: 2019-07-22T02:22:07.394Z
timestamp: 2019-07-22T02:22:11.394Z
timestamp: 2019-07-22T02:22:17.394Z
timestamp: 2019-07-22T02:22:21.395Z
timestamp: 2019-07-22T02:22:27.396Z
timestamp: 2019-07-22T02:22:31.396Z

the duration is 4 second then 6 second, but the README says it should be a 5 seconds summary data. Could you please help explain?

  1. why the duration is not 5 seconds and it is so exactly 4 and 6 seconds?
  2. will the metrics value is for 5 second summary or for 4 and 6 seconds summary as the actual time duration.