diff --git a/manifests/notifier.pp b/manifests/notifier.pp index 7075503e..d3bdd091 100644 --- a/manifests/notifier.pp +++ b/manifests/notifier.pp @@ -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], diff --git a/releasenotes/notes/notifier-batch-tunables-071a8d510dd808e2.yaml b/releasenotes/notes/notifier-batch-tunables-071a8d510dd808e2.yaml new file mode 100644 index 00000000..064cd0bc --- /dev/null +++ b/releasenotes/notes/notifier-batch-tunables-071a8d510dd808e2.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + The following two parameters have been added to the ``aodh::notifier`` + class. + + - ``batch_size`` + - ``batch_timeout`` diff --git a/spec/classes/aodh_notifier_spec.rb b/spec/classes/aodh_notifier_spec.rb index b174e952..82d4c51b 100644 --- a/spec/classes/aodh_notifier_spec.rb +++ b/spec/classes/aodh_notifier_spec.rb @@ -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('') + is_expected.to contain_aodh_config('notifier/batch_timeout').with_value('') end end