gnocchi: always set needed_overlap for aggregation

gnocchi_aggregation_by_resources_threshold set needed_overlap
to workaround #1479429, we should do the same for
gnocchi_aggregation_by_metrics_threshold.

This change does it.

Related-bug: #1479429
Change-Id: I283200e23d69dbd174f990722711d6b538fe42e3
This commit is contained in:
Mehdi Abaakouk 2016-07-07 13:30:29 +02:00
parent 6f186567bb
commit b11d9368a1
2 changed files with 11 additions and 1 deletions

View File

@ -70,10 +70,19 @@ class GnocchiResourceThresholdEvaluator(GnocchiBase):
class GnocchiAggregationMetricsThresholdEvaluator(GnocchiBase):
def _statistics(self, rule, start, end):
try:
# 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 'needed_overlap' to 0 to disable the
# gnocchi checks about missing points. For more detail see:
# https://bugs.launchpad.net/gnocchi/+bug/1479429
return self._gnocchi_client.metric.aggregation(
metrics=rule['metrics'],
start=start, stop=end,
aggregation=rule['aggregation_method'])
aggregation=rule['aggregation_method'],
needed_overlap=0)
except Exception as e:
LOG.warning(_LW('alarm stats retrieval failed: %s'), e)
return []

View File

@ -326,6 +326,7 @@ class TestGnocchiAggregationMetricsThresholdEvaluate(TestGnocchiEvaluatorBase):
metrics=[
'0bb1604d-1193-4c0a-b4b8-74b170e35e83',
'9ddc209f-42f8-41e1-b8f1-8804f59c4053'],
needed_overlap=0,
start=start_alarm, stop=end)],
self.client.metric.mock_calls)
self._assert_all_alarms('alarm')