Add statsd configuration for swift

This adds the optional configuration options:
  - statsd_host
  - statsd_port
  - statsd_metric_prefix (defaults to inventory_hostname)
  - statsd_default_sample_rate
  - statsd_sample_rate_factor

Which can be defined under swift globally or on the server level.
The configuration will only be added if statsd_host is defined.

Change-Id: I793b189e0a1f5ca4fc1fe17b1d89f2a83af8c796
This commit is contained in:
Matthew Oliver 2015-11-17 16:26:14 +11:00 committed by Jesse Pretorius
parent f97db4da18
commit c79547cb91
11 changed files with 79 additions and 0 deletions

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -4,6 +4,7 @@
swift_dir = /etc/swift
user = {{ swift_system_user_name }}
log_facility = LOG_LOCAL4
{% include "statsd.j2" %}
[object-expirer]
interval = 300

View File

@ -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

View File

@ -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

View File

@ -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(' ') }}

32
templates/statsd.j2 Normal file
View File

@ -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 %}