Ensure resource_key is in groupby in Monasca collector
We could have added the 'resource_key' option to group_by, but it would have forced a per_resource grouping (which we don't want) and would have been opaque to users. Documentation should be updated in order to explain this once #592329 is merged. Change-Id: I39571095860ad71534f05e982f1fc5b45b842d09
This commit is contained in:
parent
f28a6fae83
commit
19be45f9b2
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue