Skip to content

Instantly share code, notes, and snippets.

@tobobo
Last active December 7, 2017 19:49
Show Gist options
  • Select an option

  • Save tobobo/e68e9b415339e44cf53470c6d9ed83e0 to your computer and use it in GitHub Desktop.

Select an option

Save tobobo/e68e9b415339e44cf53470c6d9ed83e0 to your computer and use it in GitHub Desktop.
const Lynx = require('lynx');
const dgram = require('dgram');
const args = require('args');
args
.option('port', 'The statsd port to connect to', 8125)
.option('eventsuffix', 'The event name suffix', 'mycounter');
const flags = args.parse(process.argv);
const metrics = new Lynx('localhost', flags.port, {
socket: dgram.createSocket('udp4'),
scope: 'app'
});
function incrementCounter() {
metrics.increment(`counters.${flags.eventsuffix}`);
setTimeout(incrementCounter, 100);
}
incrementCounter();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment