Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
traffic: true
}
})
/**
* Probe system #1 - Histograms
*
* Measuring the event loop delay
*/
const TIME_INTERVAL = 1000
let oldTime = process.hrtime()
const histogram = io.histogram({
name: 'Loop delay',
measurement: 'mean',
unit: 'ms'
})
setInterval(() => {
const newTime = process.hrtime()
const delay = (newTime[0] - oldTime[0]) * 1e3 + (newTime[1] - oldTime[1]) / 1e6 - TIME_INTERVAL
oldTime = newTime
// Now we update the metric
histogram.update(delay)
}, TIME_INTERVAL)
/**
* Probe system #2 - Metrics