Merge "Ensure resource_key is in groupby in Monasca collector"

This commit is contained in:
Zuul 2018-08-22 10:00:10 +00:00 committed by Gerrit Code Review
commit 1795d461a6
1 changed files with 7 additions and 0 deletions

View File

@ -163,6 +163,13 @@ class MonascaCollector(collector.BaseCollector):
dimensions = self._get_dimensions(metric_name, project_id, q_filter)
group_by = self.conf[metric_name]['groupby']
resource_key = self.conf[metric_name]['extra_args']['resource_key']
if resource_key not in group_by:
LOG.error('Resource key "{}" is not in group_by keys: "{}". '
'Please adapt your configuration.'.format(
resource_key, group_by))
raise collector.NoDataCollected(self.collector_name, metric_name)
# NOTE(lpeschke): One aggregated measure per collect period
period = end - start