Add new parameter `tenant_name_discovery`

Enabling this parameter will identify user and project
names from the polled metrics [1].

These details are collected by making additional requests
to keystone service, depending upon the scale of environment,
number of projects/users and the count of metrics polled in
every iteration, enabling this could overwhelm the keystone
service.

[1] Iee5dbf09a1fd3ac571746fc66d2683eb8e6a1b27

Depends-on: https://review.opendev.org/852948
Signed-off-by: Yadnesh Kulkarni <ykulkarn@redhat.com>
Change-Id: I045c7cd7a86d0f7f97a9078cbfc74353dcff0eb8
This commit is contained in:
Yadnesh Kulkarni 2022-09-09 15:18:40 +00:00 committed by Takashi Kajinami
parent 1dcdea2e62
commit b00000fb86
3 changed files with 46 additions and 0 deletions

View File

@ -73,6 +73,10 @@
# (Optional) Batch size of samples to send to notification agent.
# Defaults to $::os_service_default
#
# [*tenant_name_discovery*]
# (optional) Identify user and project names from polled metrics.
# Defaults to $::os_service_default.
#
class ceilometer::agent::polling (
$manage_service = true,
$enabled = true,
@ -89,6 +93,7 @@ class ceilometer::agent::polling (
$polling_meters = $::ceilometer::params::polling_meters,
$polling_config = undef,
$batch_size = $::os_service_default,
$tenant_name_discovery = $::os_service_default,
) inherits ceilometer {
include ceilometer::deps
@ -96,8 +101,16 @@ class ceilometer::agent::polling (
if $central_namespace {
$central_namespace_name = 'central'
ceilometer_config {
# set `tenant_name_discovery` parameter only on the nodes
# where central namespace is enabled
'DEFAULT/tenant_name_discovery': value => $tenant_name_discovery;
}
} else {
$central_namespace_name = undef
ceilometer_config {
'DEFAULT/tenant_name_discovery': ensure => absent;
}
}
if $compute_namespace {

View File

@ -0,0 +1,7 @@
---
features:
- |
Add new parameter ``tenant_name_discovery``, whether to
idenitfy user and project names from polled samples.
This paramater is to be configured only when ceilometer
central namespace is enabled.

View File

@ -38,6 +38,7 @@ describe 'ceilometer::agent::polling' do
)}
it {
should contain_ceilometer_config('DEFAULT/tenant_name_discovery').with_value('<SERVICE DEFAULT>')
should contain_ceilometer_config('compute/instance_discovery_method').with_value('<SERVICE DEFAULT>')
should contain_ceilometer_config('compute/resource_update_interval').with_value('<SERVICE DEFAULT>')
should contain_ceilometer_config('compute/resource_cache_expiry').with_value('<SERVICE DEFAULT>')
@ -90,6 +91,18 @@ describe 'ceilometer::agent::polling' do
}
end
context 'with central parameters set' do
before do
params.merge!(
:tenant_name_discovery => false
)
end
it {
should contain_ceilometer_config('DEFAULT/tenant_name_discovery').with_value(false)
}
end
context 'with compute namespace disabled' do
before do
params.merge!(
@ -105,6 +118,19 @@ describe 'ceilometer::agent::polling' do
}
end
context 'with central namespace disabled' do
before do
params.merge!(
:central_namespace => false,
)
end
it {
should contain_ceilometer_config('DEFAULT/polling_namespaces').with_value('compute,ipmi')
should contain_ceilometer_config('DEFAULT/tenant_name_discovery').with_ensure('absent')
}
end
context 'with central and ipmi polling namespaces disabled' do
before do
params.merge!(