Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var monitor = function (host, port, prefix, suffix, globalize, cacheDns, mock, global_tags) {
var appmetrics = require('appmetrics');
var monitor = appmetrics.monitor();
var StatsD = require('hot-shots');
var client = Object.create(StatsD.prototype);
StatsD.apply(client, arguments);
monitor.on('cpu', function handleCPU(cpu) {
client.gauge('cpu.process', cpu.process);
client.gauge('cpu.system', cpu.system);
});
monitor.on('memory', function handleMem(memory) {
client.gauge('memory.process.private', memory.private);
client.gauge('memory.process.physical', memory.physical);
client.gauge('memory.process.virtual', memory.virtual);
client.gauge('memory.system.used', memory.physical_used);
client.gauge('memory.system.total', memory.physical_total);
});
monitor.on('eventloop', function handleEL(eventloop) {
client.gauge('eventloop.latency.min', eventloop.latency.min);