diff --git a/defaults/main.yml b/defaults/main.yml index 8b386ec1..6d40ab70 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -96,6 +96,11 @@ swift_service_adminurl: "{{ swift_service_adminuri }}/v1/AUTH_%(tenant_id)s" swift_service_internaluri: "{{ swift_service_internaluri_proto }}://{{ internal_lb_vip_address }}:{{ swift_proxy_port }}" swift_service_internalurl: "{{ swift_service_internaluri }}/v1/AUTH_%(tenant_id)s" swift_service_region: RegionOne +statsd_host: +statsd_port: 8125 +statsd_default_sample_rate: 1.0 +statsd_sample_rate_factor: 1.0 +statsd_metric_prefix: ## Keystone authentication middleware swift_keystone_auth_plugin: "password" diff --git a/templates/account-server-replicator.conf.j2 b/templates/account-server-replicator.conf.j2 index 2dfe13dd..fd643cbe 100644 --- a/templates/account-server-replicator.conf.j2 +++ b/templates/account-server-replicator.conf.j2 @@ -10,6 +10,7 @@ bind_port = {{ swift_account_port }} devices = {{ swift_vars.mount_point | default(swift.mount_point) }} workers = {{ swift_account_server_replicator_workers | default(api_threads) }} log_facility = LOG_LOCAL2 +{% include "statsd.j2" %} [pipeline:main] pipeline = account-server diff --git a/templates/account-server.conf.j2 b/templates/account-server.conf.j2 index 937d28c8..411bf6cc 100644 --- a/templates/account-server.conf.j2 +++ b/templates/account-server.conf.j2 @@ -11,6 +11,7 @@ workers = {{ swift_account_server_workers | default(api_threads) }} user = {{ swift_system_user_name }} devices = {{ swift_vars.mount_point | default(swift.mount_point) }} log_facility = LOG_LOCAL2 +{% include "statsd.j2" %} [pipeline:main] pipeline = healthcheck recon account-server diff --git a/templates/container-reconciler.conf.j2 b/templates/container-reconciler.conf.j2 index 0f18864b..90ebe5d0 100644 --- a/templates/container-reconciler.conf.j2 +++ b/templates/container-reconciler.conf.j2 @@ -1,7 +1,10 @@ +# {{ ansible_managed }} + [DEFAULT] swift_dir = /etc/swift user = {{ swift_system_user_name }} log_facility = LOG_LOCAL3 +{% include "statsd.j2" %} [container-reconciler] # The reconciler will re-attempt reconciliation if the source object is not diff --git a/templates/container-server-replicator.conf.j2 b/templates/container-server-replicator.conf.j2 index 7420df3c..b2aafbe4 100644 --- a/templates/container-server-replicator.conf.j2 +++ b/templates/container-server-replicator.conf.j2 @@ -10,6 +10,7 @@ bind_port = {{ swift_container_port }} devices = {{ swift_vars.mount_point | default(swift.mount_point) }} workers = {{ swift_server_replicator_workers | default(api_threads) }} log_facility = LOG_LOCAL3 +{% include "statsd.j2" %} [pipeline:main] pipeline = container-server diff --git a/templates/container-server.conf.j2 b/templates/container-server.conf.j2 index 16372de1..3445b6f9 100644 --- a/templates/container-server.conf.j2 +++ b/templates/container-server.conf.j2 @@ -11,6 +11,7 @@ workers = {{ swift_container_server_workers | default(api_threads) }} user = {{ swift_system_user_name }} devices = {{ swift_vars.mount_point | default(swift.mount_point) }} log_facility = LOG_LOCAL3 +{% include "statsd.j2" %} [pipeline:main] pipeline = healthcheck recon container-server diff --git a/templates/object-expirer.conf.j2 b/templates/object-expirer.conf.j2 index 87d8a0d0..cce70c80 100644 --- a/templates/object-expirer.conf.j2 +++ b/templates/object-expirer.conf.j2 @@ -4,6 +4,7 @@ swift_dir = /etc/swift user = {{ swift_system_user_name }} log_facility = LOG_LOCAL4 +{% include "statsd.j2" %} [object-expirer] interval = 300 diff --git a/templates/object-server-replicator.conf.j2 b/templates/object-server-replicator.conf.j2 index 5193d3b7..0f66605f 100644 --- a/templates/object-server-replicator.conf.j2 +++ b/templates/object-server-replicator.conf.j2 @@ -10,6 +10,7 @@ bind_port = {{ swift_object_port }} devices = {{ swift_vars.mount_point | default(swift.mount_point) }} workers = {{ swift_object_replicator_workers | default(api_threads) }} log_facility = LOG_LOCAL4 +{% include "statsd.j2" %} [pipeline:main] pipeline = object-server diff --git a/templates/object-server.conf.j2 b/templates/object-server.conf.j2 index 8cff6e2f..15ee74bb 100644 --- a/templates/object-server.conf.j2 +++ b/templates/object-server.conf.j2 @@ -12,6 +12,7 @@ user = {{ swift_system_user_name }} swift_dir = /etc/swift devices = {{ swift_vars.mount_point | default(swift.mount_point) }} log_facility = LOG_LOCAL4 +{% include "statsd.j2" %} [pipeline:main] pipeline = healthcheck recon object-server diff --git a/templates/proxy-server.conf.j2 b/templates/proxy-server.conf.j2 index 45fe43bd..111fd6c6 100644 --- a/templates/proxy-server.conf.j2 +++ b/templates/proxy-server.conf.j2 @@ -11,6 +11,38 @@ workers = {{ swift_proxy_server_workers | default(api_threads) }} user = {{ swift_system_user_name }} log_facility = LOG_LOCAL1 +{% if swift_proxy_vars is defined %} +{% if swift_proxy_vars.statsd_host is defined %} +{% set statsd = 1 %} +log_statsd_host = {{ swift_proxy_vars.statsd_host | default(statsd_host) }} +{% elif swift.statsd_host is defined %} +{% set statsd = 1 %} +log_statsd_host = {{ swift.statsd_host | default(statsd_host) }} +{% endif %} +{% if statsd is defined %} +{% if swift_proxy_vars.statsd_port is defined %} +log_statsd_port = {{ swift_proxy_vars.statsd_port }} +{% else %} +log_statsd_port = {{ swift.statsd_port | default(statsd_port) }} +{% endif %} +{% if swift_proxy_vars.statsd_default_sample_rate is defined %} +log_statsd_default_sample_rate = {{ swift_proxy_vars.statsd_default_sample_rate }} +{% else %} +log_statsd_default_sample_rate = {{ swift.statsd_default_sample_rate | default(statsd_default_sample_rate) }} +{% endif %} +{% if swift_proxy_vars.statsd_sample_rate_factor is defined %} +log_statsd_sample_rate_factor = {{ swift_proxy_vars.statsd_sample_rate_factor }} +{% else %} +log_statsd_sample_rate_factor = {{ swift.statsd_sample_rate_factor | default(statsd_sample_rate_factor) }} +{% endif %} +{% if swift_proxy_vars.statsd_metric_prefix is defined %} +log_statsd_metric_prefix = {{ swift_proxy_vars.statsd_metric_prefix }} +{% else %} +log_statsd_metric_prefix = {{ swift.statsd_metric_prefix | default(inventory_hostname) }} +{% endif %} +{% endif %} +{% endif %} + [pipeline:main] pipeline = {{ swift_middleware_list | join(' ') }} diff --git a/templates/statsd.j2 b/templates/statsd.j2 new file mode 100644 index 00000000..b4a9e53c --- /dev/null +++ b/templates/statsd.j2 @@ -0,0 +1,32 @@ + +{% if swift_vars is defined %} +{% if swift_vars.statsd_host is defined %} +{% set statsd = 1 %} +log_statsd_host = {{ swift_vars.statsd_host | default(statsd_host) }} +{% elif swift.statsd_host is defined %} +{% set statsd =1 %} +log_statsd_host = {{ swift.statsd_host | default(statsd_host) }} +{% endif %} +{% if statsd is defined %} +{% if swift_vars.statsd_port is defined %} +log_statsd_port = {{ swift_vars.statsd_port }} +{% else %} +log_statsd_port = {{ swift.statsd_port | default(statsd_port) }} +{% endif %} +{% if swift_vars.statsd_default_sample_rate is defined %} +log_statsd_default_sample_rate = {{ swift_vars.statsd_default_sample_rate }} +{% else %} +log_statsd_default_sample_rate = {{ swift.statsd_default_sample_rate | default(statsd_default_sample_rate) }} +{% endif %} +{% if swift_vars.statsd_sample_rate_factor is defined %} +log_statsd_sample_rate_factor = {{ swift_vars.statsd_sample_rate_factor }} +{% else %} +log_statsd_sample_rate_factor = {{ swift.statsd_sample_rate_factor | default(statsd_sample_rate_factor) }} +{% endif %} +{% if swift_vars.statsd_metric_prefix is defined %} +log_statsd_metric_prefix = {{ swift_vars.statsd_metric_prefix }} +{% else %} +log_statsd_metric_prefix = {{ swift.statsd_metric_prefix | default(inventory_hostname) }} +{% endif %} +{% endif %} +{% endif %}