switch process_metrics to take a callback function

This commit is contained in:
Dan Rowe 2012-10-15 00:20:56 -04:00
Родитель c3d87eaa82
Коммит c341f969e3
2 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -1,4 +1,4 @@
var process_metrics = function (metrics, flushInterval) {
var process_metrics = function (metrics, flushInterval, ts, flushCallback) {
var starttime = Date.now();
var key;
var counter_rates = {};
@ -81,8 +81,7 @@ var process_metrics = function (metrics, flushInterval) {
//add processed metrics to the metrics_hash
metrics.counter_rates = counter_rates;
metrics.timer_data = timer_data;
return metrics;
flushCallback(ts, metrics);
}
exports.process_metrics = process_metrics

Просмотреть файл

@ -71,10 +71,11 @@ function flushMetrics() {
}
});
metrics_hash = pm.process_metrics(metrics_hash, flushInterval)
pm.process_metrics(metrics_hash, flushInterval, time_stamp, function emitFlush() {
// Flush metrics to each backend.
backendEvents.emit('flush', time_stamp, metrics_hash);
});
// Flush metrics to each backend.
backendEvents.emit('flush', time_stamp, metrics_hash);
};
var stats = {