statsd-client
Advanced tools
| #!/usr/bin/env node | ||
| var args = process.argv; | ||
| var SDC = require('../lib/statsd-client'), | ||
| sdc = new SDC({ | ||
| host: 'localhost', | ||
| prefix: args[2] || 'data.generator' | ||
| }), | ||
| rand, | ||
| time = new Date(), | ||
| iterations = 0; | ||
| function sendSomeData() { | ||
| iterations += 1; | ||
| if (iterations % 10 === 0) { | ||
| process.stdout.write('\r' + ['◒', '◐', '◓', '◑'][iterations/10 % 4]); | ||
| iterations = iterations >= 40 ? 0 : iterations; | ||
| } | ||
| rand = Math.round(Math.random() * 10); | ||
| sdc.gauge('gauge' + rand, rand); | ||
| sdc.counter('counter' + rand, rand); | ||
| sdc.set('set' + rand, rand); | ||
| sdc.timing('timer' + rand, time); | ||
| time = new Date(); | ||
| setTimeout(sendSomeData, rand); | ||
| } | ||
| sendSomeData(); |
@@ -48,2 +48,5 @@ var dgram = require('dgram'); | ||
| //Make sure further errors do not propagate upwards | ||
| this._socket.on("error", function () {}); | ||
| // Cancel the running timer | ||
@@ -50,0 +53,0 @@ clearInterval(this._socketTimer); |
+1
-1
@@ -6,3 +6,3 @@ { | ||
| "keywords": ["statsd", "client", "metrics", "udp"], | ||
| "version": "0.0.7", | ||
| "version": "0.0.8", | ||
| "homepage": "https://github.com/msiebuhr/node-statsd-client", | ||
@@ -9,0 +9,0 @@ "bugs": "https://github.com/msiebuhr/node-statsd-client/issues", |
@@ -21,2 +21,3 @@ /* Test the Ephemeral socket | ||
| it("Send 50 messages", function (done) { | ||
| this.slow(500); | ||
| for (var i = 0; i < 50; i += 1) { | ||
@@ -48,2 +49,15 @@ e.send('foobar'); | ||
| it("Does not crash when many errors are emitted", function (done) { | ||
| e._createSocket(function () { | ||
| e._socket.emit('error'); | ||
| e._socket.emit('error'); | ||
| e._socket.emit('error'); | ||
| setTimeout(function () { | ||
| assert.isUndefined(e._socket); | ||
| done(); | ||
| }, 15); | ||
| }); | ||
| }); | ||
| describe("Socket timeout", function () { | ||
@@ -63,5 +77,5 @@ var te; | ||
| done(); | ||
| }, 10); | ||
| }, 15); | ||
| }); | ||
| }); | ||
| }); |
@@ -79,2 +79,3 @@ var StatsDClient = require('../lib/statsd-client'), | ||
| it('.timing("foo", new Date(-20ms)) ~→ "foo:20|ms"', function (done) { | ||
| this.slow(100); | ||
| var d = new Date(); | ||
@@ -81,0 +82,0 @@ setTimeout(function () { |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
26163
5.12%20
5.26%591
7.26%4
33.33%