Permalink
Browse files

Merge branch 'metrics' into 0.9.0

  • Loading branch information...
2 parents e8dd388 + a9fd4ab commit d2066e123dc40ae3d803dd9ccd202c5751f17cf9 Jason Jackson committed Dec 6, 2012
@@ -269,7 +269,10 @@
interval)
data-points (->> name->imetric
(map (fn [[name imetric]]
- (IMetricsConsumer$DataPoint. name (.getValueAndReset ^IMetric imetric))))
+ (let [value (.getValueAndReset ^IMetric imetric)]
+ (if value
+ (IMetricsConsumer$DataPoint. name value)))))
+ (filter identity)
(into []))]]
(if (seq data-points)
(task/send-unanchored task-data Constants/METRICS_STREAM_ID [task-info data-points])))))
@@ -29,6 +29,10 @@ public MeanReducerState reduce(MeanReducerState acc, Object input) {
}
public Object extractResult(MeanReducerState acc) {
- return new Double(acc.sum / (double)acc.count);
+ if(acc.count > 0) {
+ return new Double(acc.sum / (double)acc.count);
+ } else {
+ return null;
+ }
}
}

0 comments on commit d2066e1

Please sign in to comment.