Last active
December 7, 2017 19:49
-
-
Save tobobo/e68e9b415339e44cf53470c6d9ed83e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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