зеркало из https://github.com/microsoft/statsd.git
Remove Error handling stuff for now
This commit is contained in:
Родитель
4530718f40
Коммит
00c0c1fa8c
|
@ -2,7 +2,6 @@ var process_metrics = function (metrics, flushInterval, ts, flushCallback) {
|
|||
var key;
|
||||
var counter_rates = {};
|
||||
var timer_data = {};
|
||||
var error = false;
|
||||
var counters = metrics.counters;
|
||||
var timers = metrics.timers;
|
||||
var pctThreshold = metrics.pctThreshold;
|
||||
|
@ -80,11 +79,7 @@ var process_metrics = function (metrics, flushInterval, ts, flushCallback) {
|
|||
metrics.counter_rates = counter_rates;
|
||||
metrics.timer_data = timer_data;
|
||||
|
||||
if (Object.keys(counter_rates).length == 0 && Object.keys(timer_data).length == 0 ) {
|
||||
error = "no metrics to calculate";
|
||||
}
|
||||
|
||||
flushCallback(error, metrics);
|
||||
flushCallback(metrics);
|
||||
}
|
||||
|
||||
exports.process_metrics = process_metrics
|
||||
|
|
13
stats.js
13
stats.js
|
@ -13,8 +13,7 @@ var dgram = require('dgram')
|
|||
var keyCounter = {};
|
||||
var counters = {
|
||||
"statsd.packets_received": 0,
|
||||
"statsd.bad_lines_seen": 0,
|
||||
"statsd.calculation_error": 0
|
||||
"statsd.bad_lines_seen": 0
|
||||
};
|
||||
var timers = {};
|
||||
var gauges = {};
|
||||
|
@ -73,12 +72,7 @@ function flushMetrics() {
|
|||
}
|
||||
});
|
||||
|
||||
pm.process_metrics(metrics_hash, flushInterval, time_stamp, function emitFlush(err, metrics) {
|
||||
if (err) {
|
||||
l.log("Calculation Error: " + err);
|
||||
counters["statsd.calculation_error"]++;
|
||||
stats['messages']['calculation_error']++;
|
||||
}
|
||||
pm.process_metrics(metrics_hash, flushInterval, time_stamp, function emitFlush(metrics) {
|
||||
backendEvents.emit('flush', time_stamp, metrics);
|
||||
});
|
||||
|
||||
|
@ -87,8 +81,7 @@ function flushMetrics() {
|
|||
var stats = {
|
||||
messages: {
|
||||
last_msg_seen: startup_time,
|
||||
bad_lines_seen: 0,
|
||||
calculation_error: 0
|
||||
bad_lines_seen: 0
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ module.exports = {
|
|||
return data;
|
||||
});
|
||||
test.ok(_.include(_.map(entries,function(x) { return _.keys(x)[0] }),'statsd.numStats'),'graphite output includes numStats');
|
||||
test.equal(_.find(entries, function(x) { return _.keys(x)[0] == 'statsd.numStats' })['statsd.numStats'],3);
|
||||
test.equal(_.find(entries, function(x) { return _.keys(x)[0] == 'statsd.numStats' })['statsd.numStats'],2);
|
||||
test.done();
|
||||
});
|
||||
});
|
||||
|
@ -205,9 +205,9 @@ module.exports = {
|
|||
});
|
||||
var numstat_test = function(post){
|
||||
var mykey = 'statsd.numStats';
|
||||
return _.include(_.keys(post),mykey) && (post[mykey] == 4);
|
||||
return _.include(_.keys(post),mykey) && (post[mykey] == 3);
|
||||
};
|
||||
test.ok(_.any(hashes,numstat_test), 'statsd.numStats should be 1');
|
||||
test.ok(_.any(hashes,numstat_test), 'statsd.numStats should be 3');
|
||||
|
||||
var testavgvalue_test = function(post){
|
||||
var mykey = 'stats.a_test_value';
|
||||
|
|
Загрузка…
Ссылка в новой задаче