Support batch_* parameters of notifier

This change introduces support for batch_* parameters in notifier,
which are tunable parameters about batch processing of alarms.

Change-Id: I8beee8a794b6607875fbc7a46ccc1e58c0c344b5
This commit is contained in:
Takashi Kajinami 2021-04-23 22:57:38 +09:00
parent e3fa374ac9
commit 86aa1e34e9
3 changed files with 39 additions and 1 deletions

View File

@ -17,18 +17,32 @@
# (optional) Number of workers for notifier service.
# Defaults to $::os_workers.
#
# [*batch_size*]
# (optional) Number of notification messages to wait before dispatching
# them.
# Defaults to $::os_service_default.
#
# [*batch_timeout*]
# (optional) Number of seconds to wait before dispatching samples when
# batch_size is not reached.
# Defaults to $::os_service_default
#
class aodh::notifier (
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
$workers = $::os_workers,
$batch_size = $::os_service_default,
$batch_timeout = $::os_service_default,
) {
include aodh::deps
include aodh::params
aodh_config {
'notifier/workers': value => $workers;
'notifier/workers': value => $workers;
'notifier/batch_size': value => $batch_size;
'notifier/batch_timeout': value => $batch_timeout
}
ensure_resource( 'package', [$::aodh::params::notifier_package_name],

View File

@ -0,0 +1,8 @@
---
features:
- |
The following two parameters have been added to the ``aodh::notifier``
class.
- ``batch_size``
- ``batch_timeout``

View File

@ -18,6 +18,20 @@ describe 'aodh::notifier' do
end
end
context 'with batch parameters' do
let :params do
{
:batch_size => 100,
:batch_timeout => 60,
}
end
it 'configures batch options' do
is_expected.to contain_aodh_config('notifier/batch_size').with_value(100)
is_expected.to contain_aodh_config('notifier/batch_timeout').with_value(60)
end
end
context 'when enabled' do
it { is_expected.to contain_class('aodh::params') }
@ -41,6 +55,8 @@ describe 'aodh::notifier' do
it 'sets default values' do
is_expected.to contain_aodh_config('notifier/workers').with_value(4)
is_expected.to contain_aodh_config('notifier/batch_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('notifier/batch_timeout').with_value('<SERVICE DEFAULT>')
end
end