Exclude metrics from "service" project

Upon installing ceilometer and gnocchi using devstack,
"filter_project" in "pipeline.yaml" is set to "gnocchi_swift"
project. However, no such project exists in keystone.
```
publishers:
  - gnocchi://?archive_policy=ceilometer-low&filter_project=gnocchi_swift
```

This change, will set "filter_project" to "service" project which
will exclude all metrics from it.

Also add the name of the project to the logs which couldn't be found
in keystone.

Closes-Bug: #1988923
Signed-off-by: Yadnesh Kulkarni <ykulkarn@redhat.com>
Change-Id: Ifc215f86134729665c142bb9bf64f66ca8de2a29
This commit is contained in:
Yadnesh Kulkarni 2022-08-10 05:18:38 -04:00
parent fb184a9e59
commit 8e57a3a6f3
3 changed files with 5 additions and 5 deletions

View File

@ -287,9 +287,9 @@ class GnocchiPublisher(publisher.ConfigPublisherBase):
name=self.filter_project,
domain=self.filter_domain)
except ka_exceptions.NotFound:
LOG.warning('filtered project not found in keystone,'
LOG.warning('project %s not found in keystone,'
' ignoring the filter_project '
'option')
'option', self.filter_project)
self.filter_project = None
return None
except Exception:

View File

@ -339,9 +339,9 @@ class PublisherTest(base.BaseTestCase):
def test_activity_gnocchi_project_not_found(self, logger):
self.ks_client.projects.find.side_effect = ka_exceptions.NotFound
self._do_test_activity_filter(2)
logger.warning.assert_called_with('filtered project not found in '
logger.warning.assert_called_with('project %s not found in '
'keystone, ignoring the '
'filter_project option')
'filter_project option', 'service')
def test_activity_filter_match_swift_event(self):
self.samples[0].name = 'storage.objects.outgoing.bytes'

View File

@ -208,7 +208,7 @@ function _ceilometer_configure_storage_backend {
if [ "$CEILOMETER_BACKEND" = 'none' ] ; then
echo_summary "All Ceilometer backends seems disabled, set \$CEILOMETER_BACKEND to select one."
elif [ "$CEILOMETER_BACKEND" = 'gnocchi' ] ; then
sed -i "s/gnocchi:\/\//gnocchi:\/\/?archive_policy=${GNOCCHI_ARCHIVE_POLICY}\&filter_project=gnocchi_swift/" $CEILOMETER_CONF_DIR/event_pipeline.yaml $CEILOMETER_CONF_DIR/pipeline.yaml
sed -i "s/gnocchi:\/\//gnocchi:\/\/?archive_policy=${GNOCCHI_ARCHIVE_POLICY}\&filter_project=service/" $CEILOMETER_CONF_DIR/event_pipeline.yaml $CEILOMETER_CONF_DIR/pipeline.yaml
! [[ $DEVSTACK_PLUGINS =~ 'gnocchi' ]] && configure_gnocchi
else
die $LINENO "Unable to configure unknown CEILOMETER_BACKEND $CEILOMETER_BACKEND"