statsd: Add support for host and port

This change introduces support for the following two parameters.
 - [statsd] host
 - [statsd] port

Change-Id: Ia4e4a5d5ae40a7d4a358569d9caacb07ff391d6a
This commit is contained in:
Takashi Kajinami 2022-04-25 08:39:43 +09:00
parent bce487db88
commit 4bd702bc91
3 changed files with 32 additions and 0 deletions

View File

@ -5,6 +5,14 @@
# [*resource_id*]
# (required) Resource UUID to use to identify statsd in Gnocchi.
#
# [*host*]
# (optional) The listen IP for statsd.
# Defaults to $::os_service_default
#
# [*port*]
# (optional) The port for statsd.
# Defaults to $::os_service_default.
#
# [*flush_delay*]
# (optional) Delay between flushes.
# Defaults to $::os_service_default
@ -27,6 +35,8 @@
#
class gnocchi::statsd (
$resource_id,
$host = $::os_service_default,
$port = $::os_service_default,
$flush_delay = $::os_service_default,
$archive_policy_name = $::os_service_default,
$manage_service = true,
@ -61,6 +71,8 @@ class gnocchi::statsd (
gnocchi_config {
'statsd/resource_id' : value => $resource_id;
'statsd/host' : value => $host;
'statsd/port' : value => $port;
'statsd/archive_policy_name' : value => $archive_policy_name;
'statsd/flush_delay' : value => $flush_delay;
}

View File

@ -0,0 +1,4 @@
---
features:
- |
The ``gnocchi::statsd`` class now supports ``host`` and ``port``.

View File

@ -24,6 +24,8 @@ describe 'gnocchi::statsd' do
it 'configures gnocchi statsd' do
is_expected.to contain_gnocchi_config('statsd/resource_id').with_value('07f26121-5777-48ba-8a0b-d70468133dd9')
is_expected.to contain_gnocchi_config('statsd/host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_gnocchi_config('statsd/port').with_value('<SERVICE DEFAULT>')
is_expected.to contain_gnocchi_config('statsd/flush_delay').with_value('<SERVICE DEFAULT>')
is_expected.to contain_gnocchi_config('statsd/archive_policy_name').with_value('<SERVICE DEFAULT>')
end
@ -59,6 +61,20 @@ describe 'gnocchi::statsd' do
end
end
context 'whth host and port' do
before do
params.merge!({
:host => '192.0.2.1',
:port => 8125,
})
end
it 'configures the parameter' do
is_expected.to contain_gnocchi_config('statsd/host').with_value('192.0.2.1')
is_expected.to contain_gnocchi_config('statsd/port').with_value(8125)
end
end
context 'with flush_delay' do
before do
params.merge!({ :flush_delay => 10 })