Skip to content

Commit

Permalink
[dist] 0.0.8
Browse files Browse the repository at this point in the history
* Fixes regex problems and conformance to standard
  • Loading branch information
dscape committed Nov 13, 2012
1 parent f92faae commit da549e7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/lynx.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ Lynx.prototype.gauge = function gauge(stat, value, sample_rate) {
//
// Will sample this data for a given sample_rate. If a random generated
// number matches that sample_rate then stats get returned and the sample
// rate gets appended ("@0.5" in this case). Else we get an empty object.
// rate gets appended ("|@0.5" in this case). Else we get an empty object.
//
Lynx.prototype.send = function send(stats, sample_rate) {
var self = this
Expand Down Expand Up @@ -515,7 +515,7 @@ Lynx.prototype.destroy = function destroy() {
//
// Will sample this data for a given sample_rate. If a random generated
// number matches that sample_rate then stats get returned and the sample
// rate gets appended ("@0.5" in this case). Else we get an empty object.
// rate gets appended ("|@0.5" in this case). Else we get an empty object.
//
Lynx.sample = function sample(stats, sample_rate) {
//
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "name" : "lynx"
, "description" : "Minimalistic StatsD client for Node.js programs"
, "version" : "0.0.7"
, "version" : "0.0.8"
, "author" : "Lloyd Hilaiel"
, "contributors": [ "Nuno Job <nunojobpinto@gmail.com> (http://nunojob.com)" ]
, "scripts" : { "test": "tap tests/*-test.js" }
Expand All @@ -22,7 +22,7 @@
, "graphite"
]
, "devDependencies": { "tap" : "~0.3.2" }
, "dependencies" : { "mersenne" : "~0.0.3", "statsd-parser": "~0.0.0" }
, "dependencies" : { "mersenne" : "~0.0.3", "statsd-parser": "~0.0.4" }
, "licenses" :
[ { "type" : "MIT"
, "url" : "http://github.com/dscape/lynx/raw/master/LICENSE"
Expand Down
14 changes: 14 additions & 0 deletions tests/sampling-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var macros = require('./macros')
, statsd = require('statsd-parser')
, lynx = macros.lynx
, test = macros.test
, udpServer = macros.udpServer
Expand Down Expand Up @@ -26,6 +27,11 @@ for(i=0; i<TOTAL; i++) {
coll.push(i);
}

//
// Remove console.log from errors, plenty of nothing to send here
//
connection.on_error = function () {};

//
// We are going to do one thousand `TOTAL` packets
// and see if we hit our minimums
Expand All @@ -44,6 +50,14 @@ test('sampling', function (t) {
var server = udpServer(function (message, remote) {
count++;

//
// Add, check if its a valid statsd message and includes sample rate
// that is teh same as being tested
//
var match = statsd.matchStatsd(message.toString());
t.ok(match, message.toString());
t.equal(SAMPLE.toString(), match.sample_rate);

//
// When we finally hit our lower threshold
//
Expand Down

0 comments on commit da549e7

Please sign in to comment.