Merge "gnocchi: percent_of_overlap=0 for agg. alarms"

This commit is contained in:
Jenkins 2015-08-06 11:11:50 +00:00 committed by Gerrit Code Review
commit d466bed736
3 changed files with 14 additions and 2 deletions

View File

@ -123,7 +123,10 @@ class AggregationMetricByResourcesLookupRule(AlarmGnocchiThresholdRule):
"The name of the metric"
query = wsme.wsattr(wtypes.text, mandatory=True)
"The query to filter the metric"
('The query to filter the metric, Don\'t forget to filter out '
'deleted resources (example: {"and": [{"=": {"ended_at": null}}, ...]}), '
'Otherwise Gnocchi will try to create the aggregate against obsolete '
'resources')
resource_type = wsme.wsattr(wtypes.text, mandatory=True)
"The resource type"

View File

@ -60,6 +60,14 @@ class GnocchiThresholdEvaluator(threshold.ThresholdEvaluator):
req['url'] += "/aggregation/resource/%s/metric/%s" % (
alarm.rule['resource_type'], alarm.rule['metric'])
req['data'] = alarm.rule['query']
# FIXME(sileht): In case of a heat autoscaling stack decide to
# delete an instance, the gnocchi metrics associated to this
# instance will be no more updated and when the alarm will ask
# for the aggregation, gnocchi will raise a 'No overlap' exception.
# So temporary set 'percent_of_overlap' to 0 to disable the
# gnocchi checks about missing points. For more detail see:
# https://bugs.launchpad.net/gnocchi/+bug/1479429
req['params']['percent_of_overlap'] = 0
elif alarm.type == 'gnocchi_aggregation_by_metrics_threshold':
req['url'] += "/aggregation/metric"

View File

@ -227,7 +227,8 @@ class TestGnocchiThresholdEvaluate(base.TestEvaluatorBase):
mock.call(url='http://localhost:8041/v1/aggregation/resource/'
'instance/metric/cpu_util',
params={'aggregation': 'mean',
'start': start_alarm3, 'end': end},
'start': start_alarm3, 'end': end,
'percent_of_overlap': 0},
data='{"=": {"server_group": "my_autoscaling_group"}}',
headers=expected_headers),
],