]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
heat engine : watchrule quietly discard unused metric data
authorSteven Hardy <shardy@redhat.com>
Wed, 6 Mar 2013 14:55:12 +0000 (14:55 +0000)
committerSteven Hardy <shardy@redhat.com>
Wed, 6 Mar 2013 17:28:10 +0000 (17:28 +0000)
Some cfn-push-stats options try to send multiple metrics to a
watch, which won't work with our simplified CW implementation
which expects exactly one Metric associated with each watch
(since that's all you can define via the template)
So quietly discard any metric data we aren't interested in.

ref bug 1133510

Change-Id: I5159611b96c501ff2d8e6e605cbd3d4ae5f77e48

heat/engine/watchrule.py

index fe267b37ac529315608ce2a4cf677088dbbdb252..c55df70e940bd5859255671ba3ef17bbfa29d841 100644 (file)
@@ -247,10 +247,14 @@ class WatchRule(object):
 
     def create_watch_data(self, data):
         if not self.rule['MetricName'] in data:
-            logger.warn('new data has incorrect metric:%s' %
-                        (self.rule['MetricName']))
-            raise ValueError('MetricName %s missing' %
-                             self.rule['MetricName'])
+            # Our simplified cloudwatch implementation only expects a single
+            # Metric associated with each alarm, but some cfn-push-stats
+            # options, e.g --haproxy try to push multiple metrics when we
+            # actually only care about one (the one we're alarming on)
+            # so just ignore any data which doesn't contain MetricName
+            logger.debug('Ignoring metric data (only accept %s) : %s' %
+                        (self.rule['MetricName'], data))
+            return
 
         watch_data = {
             'data': data,