Merge "Support cross-tenant metrics in monasca collector"

This commit is contained in:
Zuul 2020-02-10 10:17:03 +00:00 committed by Gerrit Code Review
commit 460bcb5de3
3 changed files with 14 additions and 2 deletions

View File

@ -177,7 +177,11 @@ class MonascaCollector(collector.BaseCollector):
extra_args = self.conf[metric_name]['extra_args'] extra_args = self.conf[metric_name]['extra_args']
kwargs = {} kwargs = {}
if extra_args['forced_project_id']: if extra_args['forced_project_id']:
kwargs['tenant_id'] = extra_args['forced_project_id'] if extra_args['forced_project_id'] == 'SCOPE_ID' and project_id:
kwargs['tenant_id'] = project_id
dimensions.pop(CONF.collect.scope_key, None)
else:
kwargs['tenant_id'] = extra_args['forced_project_id']
return self._conn.metrics.list_statistics( return self._conn.metrics.list_statistics(
name=metric_name, name=metric_name,

View File

@ -294,7 +294,9 @@ Monasca
fetched from a specific tenant instead of the one cloudkitty is identified fetched from a specific tenant instead of the one cloudkitty is identified
in. For example, if cloudkitty is identified in the ``service`` project, but in. For example, if cloudkitty is identified in the ``service`` project, but
needs to fetch a metric from the ``admin`` project, its ID should be needs to fetch a metric from the ``admin`` project, its ID should be
specified through this option. specified through this option. If this option is set to ``SCOPE_ID``,
the metric will be fetched from the current project (this assumes that
scopes are configured to be projects/tenants).
Prometheus Prometheus
~~~~~~~~~~ ~~~~~~~~~~

View File

@ -0,0 +1,6 @@
---
features:
- |
Cross-tenant metric submission is now supported in the monasca collector.
In order to a fetch metric from the scope that is currently being processed,
the ``forced_project_id`` option must be set to ``SCOPE_ID``.