← Back to team overview

graphite-dev team mailing list archive

[Merge] lp:~mleinartas/graphite/aggregation_overwrite into lp:graphite

 

Michael Leinartas has proposed merging lp:~mleinartas/graphite/aggregation_overwrite into lp:graphite.

Requested reviews:
  graphite-dev (graphite-dev)

For more details, see:
https://code.launchpad.net/~mleinartas/graphite/aggregation_overwrite/+merge/85606

This is a small patch to address the issue here: https://answers.launchpad.net/graphite/+question/179788 which is something I also run into and have had to work around.

There is a use case for using carbon-aggregator to aggregate incoming metrics and have the original values discarded and replaced with the new, aggregated ones. This could, for instance, replace the role of statsd and its clones for some users. The existing behavior is also surprising and I cannot imagine a case where it would be a desired behavior.
-- 
https://code.launchpad.net/~mleinartas/graphite/aggregation_overwrite/+merge/85606
Your team graphite-dev is requested to review the proposed merge of lp:~mleinartas/graphite/aggregation_overwrite into lp:graphite.
=== modified file 'carbon/lib/carbon/aggregator/receiver.py'
--- carbon/lib/carbon/aggregator/receiver.py	2011-08-19 07:19:16 +0000
+++ carbon/lib/carbon/aggregator/receiver.py	2011-12-14 05:30:41 +0000
@@ -11,11 +11,15 @@
   for rule in RewriteRuleManager.preRules:
     metric = rule.apply(metric)
 
+  aggregate_metrics = []
+
   for rule in RuleManager.rules:
     aggregate_metric = rule.get_aggregate_metric(metric)
 
     if aggregate_metric is None:
       continue
+    else
+      aggregate_metrics.append(aggregate_metric)
 
     buffer = BufferManager.get_buffer(aggregate_metric)
 
@@ -27,4 +31,5 @@
   for rule in RewriteRuleManager.postRules:
     metric = rule.apply(metric)
 
-  events.metricGenerated(metric, datapoint)
+  if metric not in aggregate_metrics:
+    events.metricGenerated(metric, datapoint)


Follow ups