Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

switch process_metrics to take a callback function

  • Loading branch information...
commit c341f969e34d664700c900d80e50ed959504dc05 1 parent c3d87ea
@draco2003 authored
Showing with 6 additions and 6 deletions.
  1. +2 −3 lib/process_metrics.js
  2. +4 −3 stats.js
View
5 lib/process_metrics.js
@@ -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
View
7 stats.js
@@ -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 = {
Please sign in to comment.
Something went wrong with that request. Please try again.