gnocchi: percent_of_overlap=0 for agg. alarms

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.

And adds some docs about the importance of filter out resource
with ended_at != 'null'.

For more detail see:
  https://bugs.launchpad.net/gnocchi/+bug/1479429

Related bug: #1479429

Change-Id: I528d21c048d84b9552febd08f787812c668983ab
This commit is contained in:
Mehdi Abaakouk 2015-08-04 16:49:21 +02:00
parent 2c2734cc7a
commit 75b2c47db7
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),
],