How to use the hot-shots.apply function in hot-shots

To help you get started, we’ve selected a few hot-shots examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RuntimeTools / appmetrics-statsd / lib / appmetrics-statsd.js View on Github external
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);

hot-shots

Node.js client for StatsD, DogStatsD, and Telegraf

MIT
Latest version published 1 month ago

Package Health Score

85 / 100
Full package analysis