forked from statsd/statsd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
238 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
statsd (0.6.0-1) unstable; urgency=low | ||
|
||
* Non-maintainer upload. | ||
* Fix lintian error messages regarding init script removal but not | ||
installing them, using adduser but not defining the dependencies, | ||
using /var/run/ in debian/dirs even though it can be a tmpfs, init script | ||
not depending on $remote_fs, spelling mistakes | ||
* removing depedency on ${misc:Depends} as this got only added as lintian | ||
used to complain about not having it, it's not anymore | ||
* Align version number to git tag versions | ||
|
||
-- Frederic Jaeckel <[email protected]> Tue, 20 Aug 2013 14:03:10 +0200 | ||
|
||
statsd (0.0.6-1) unstable; urgency=low | ||
|
||
* Update packaging for 0.0.6 | ||
* Bump nodejs dependancy to 0.6 per pcakage.json | ||
* Bump nodejs dependency to 0.6 per package.json | ||
|
||
-- Kiall Mac Innes <[email protected]> Thu, 27 Jun 2013 19:17:00 +0100 | ||
|
||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
var/log/statsd | ||
var/run/statsd |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* Public: test function to filter out malformed packets | ||
* | ||
* Parameters: | ||
* | ||
* fields - Array of packet data (e.g. [ '100', 'ms', '@0.1' ]) | ||
* | ||
* Returns true for a valid packet and false otherwise | ||
*/ | ||
function is_valid_packet(fields) { | ||
|
||
// test for existing metrics type | ||
if (fields[1] === undefined) { | ||
return false; | ||
} | ||
// filter out invalid metrics values | ||
else if (fields[1] == 'g') { | ||
if (!fields[0].match(/^([\-\+\d\.]+$)/)) { | ||
return false; | ||
} else { | ||
return true; | ||
} | ||
} | ||
else if (!fields[0].match(/^([\d\.]+$)/)) { | ||
return false; | ||
} | ||
// filter out malformed sample rates | ||
else if (fields[2] && !fields[2].match(/^@([\d\.]+$)/)) { | ||
return false; | ||
} | ||
// looks like we're good | ||
else { | ||
return true; | ||
} | ||
|
||
}; | ||
|
||
exports.is_valid_packet = is_valid_packet; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
var util = require('util'); | ||
|
||
var conf; | ||
|
||
exports.init = function(config) { | ||
conf = config; | ||
exports.set_title(config); | ||
|
||
process.on('SIGTERM', function() { | ||
if (conf.debug) { | ||
util.log('Starting Final Flush'); | ||
} | ||
healthStatus = 'down'; | ||
process.exit(); | ||
}); | ||
|
||
} | ||
|
||
exports.set_title = function(config) { | ||
if (config.title !== undefined) { | ||
if (config.title) { | ||
process.title = config.title; | ||
} | ||
} else { | ||
process.title = 'statsd'; | ||
} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
var helpers = require('../lib/helpers'); | ||
|
||
module.exports = { | ||
|
||
no_metrics_field: function (test) { | ||
var res = helpers.is_valid_packet(['foo', undefined]); | ||
test.equals(res, false); | ||
test.done(); | ||
}, | ||
|
||
wrong_formated_metric_value: function (test) { | ||
var res = helpers.is_valid_packet(['0,345345', 'ms']); | ||
test.equals(res, false); | ||
test.done(); | ||
}, | ||
|
||
wrong_formated_sampling_value: function (test) { | ||
var res = helpers.is_valid_packet(['345345', 'ms', '0,456456']); | ||
test.equals(res, false); | ||
test.done(); | ||
}, | ||
|
||
counter_deltas_positive_are_not_valid: function (test) { | ||
var res = helpers.is_valid_packet(['+10', 'c']); | ||
test.equals(res, false); | ||
test.done(); | ||
}, | ||
|
||
counter_deltas_negative_are_not_valid: function (test) { | ||
var res = helpers.is_valid_packet(['-10', 'c']); | ||
test.equals(res, false); | ||
test.done(); | ||
}, | ||
|
||
gauges_delta_positive_are_valid: function (test) { | ||
var res = helpers.is_valid_packet(['+10', 'g']); | ||
test.equals(res, true); | ||
test.done(); | ||
}, | ||
|
||
gauges_delta_negative_are_valid: function (test) { | ||
var res = helpers.is_valid_packet(['-10', 'g']); | ||
test.equals(res, true); | ||
test.done(); | ||
}, | ||
|
||
correct_packet: function (test) { | ||
var res = helpers.is_valid_packet(['345345', 'ms', '@1.0']); | ||
test.equals(res, true); | ||
test.done(); | ||
}, | ||
|
||
correct_packet_with_small_sampling: function (test) { | ||
var res = helpers.is_valid_packet(['100', 'ms', '@0.1']); | ||
test.equals(res, true); | ||
test.done(); | ||
} | ||
|
||
}; |
Oops, something went wrong.