How to use the hot-shots.prototype 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 wikimedia / service-runner / lib / statsd.js View on Github external
childClient() {
        return new LogStatsD(
            this._logger,
            this._serviceName
        );
    }
}

const timingMixin = {
    endTiming(names, startTime, samplingInterval) {
        return this.timing(names, Date.now() - startTime, samplingInterval);
    }
};

// Also add a small utility to send a delta given a startTime
Object.assign(StatsD.prototype, timingMixin);
Object.assign(LogStatsD.prototype, timingMixin);

// Minimal StatsD wrapper
function makeStatsD(options, logger) {
    let statsd;
    const srvName = options._prefix ? options._prefix : normalizeName(options.name);
    const statsdOptions = {
        host: options.host,
        port: options.port,
        prefix: `${srvName}.`,
        suffix: '',
        globalize: false,
        cacheDns: false,
        mock: false
    };
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) {

hot-shots

Node.js client for StatsD, DogStatsD, and Telegraf

MIT
Latest version published 2 months ago

Package Health Score

85 / 100
Full package analysis