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 61086079f0
commit 093e41e0ef
13 changed files with 181 additions and 0 deletions

View File

@ -44,6 +44,11 @@ file**
# index: 1
# repl_number: 3
# deprecated: True
# statsd_host: statsd.example.com
# statsd_port: 8125
# statsd_metric_prefix:
# statsd_default_sample_rate: 1.0
# statsd_sample_rate_factor: 1.0
``part_power``
@ -129,6 +134,27 @@ file**
``repl_number`` are the only values that can be set. Setting them
in this section overrides the defaults for the specific ring.
``statsd_host``
Swift supports sending extra metrics to a statsd host. This option
sets the statsd host that will receive statsd metrics. Specifying
this here will apply to all hosts in the cluster.
If statsd_host is left blank or omitted then statsd will be
disabled.
All statsd settings can be overridden or specified deeper in the
structure if you want to only catch statsd metrics on certain hosts.
``statsd_port``
Optionally, use this to specify the statsd server's port your sending
metrics to. Defaults to 8125 of omitted.
``statsd_default_sample_rate`` and ``statsd_sample_rate_factor``
These statsd related options are a little more complicated and are
used to tune how many samples are sent to statsd. Omit them unless
you need to tweak these settings, if so first read:
http://docs.openstack.org/developer/swift/admin_guide.html
#. Update the Object Storage proxy hosts values:
.. code-block:: yaml
@ -136,16 +162,25 @@ file**
# swift-proxy_hosts:
# infra-node1:
# ip: 192.0.2.1
# statsd_metric_prefix: proxy01
# infra-node2:
# ip: 192.0.2.2
# statsd_metric_prefix: proxy02
# infra-node3:
# ip: 192.0.2.3
# statsd_metric_prefix: proxy03
``swift-proxy_hosts``
Set the ``IP`` address of the hosts that Ansible will connect to
to deploy the swift-proxy containers. The ``swift-proxy_hosts``
value should match the infra nodes.
``statsd_metric_prefix``
This metric is optional, and also only evaluated it you have defined
``statsd_host`` somewhere. It allows you define a prefix to add to
all statsd metrics sent from this hose. If omitted the node name will
be used.
#. Update the Object Storage hosts values:
.. code-block:: yaml
@ -156,16 +191,19 @@ file**
# container_vars:
# swift_vars:
# zone: 0
# statsd_metric_prefix: node1
# swift-node2:
# ip: 192.0.2.5
# container_vars:
# swift_vars:
# zone: 1
# statsd_metric_prefix: node2
# swift-node3:
# ip: 192.0.2.6
# container_vars:
# swift_vars:
# zone: 2
# statsd_metric_prefix: node3
# swift-node4:
# ip: 192.0.2.7
# container_vars:
@ -242,6 +280,12 @@ file**
Set the names of the drives on this Object Storage host. At least
one name must be specified.
``statsd_metric_prefix``
This metric is optional, and also only evaluated it you have defined
``statsd_host`` somewhere. It allows you define a prefix to add to
all statsd metrics sent from this hose. If omitted the node name will
be used.
In the following example, ``swift-node5`` shows values in the
``swift_hosts`` section that will override the global values. Groups
are set, which overrides the global settings for drive ``sdb``. The

View File

@ -85,6 +85,26 @@
# The amount of time in seconds before items, such as tombstones are
# reclaimed, default is 604800 (7 Days).
#
# Option: statsd_host (optional, string)
# Swift supports statsd metrics, this option sets the statsd host that will
# receive statsd metrics. Specifying this here will apply to all hosts in
# a cluster. It can be overridden or specified deeper in the structure if you
# want to only catch statsd metrics on certain hosts.
#
# Option: statsd_port (optional, integer, default 8125)
# Statsd port, requires statsd_host set.
#
# Option: statsd_metric_prefix (optional, string, default ansible_host)
# Specify a prefix that will be prepended to all metrics, this should be specified
# deeper in the configuration so different host metrics can be separated.
#
# The following statsd related options are a little more complicated and are
# used to tune how many samples are sent to statsd. If you need to tweak these
# settings then first read: http://docs.openstack.org/developer/swift/admin_guide.html
#
# Option: statsd_default_sample_rate (optional, float, default 1.0)
# Option: statsd_sample_rate_factor (optional, float, default 1.0)
#
# Example:
#
# Define a typical deployment:
@ -109,6 +129,8 @@
# region: 1
# zone: 0
# weight: 100
# statsd_host: statsd.example.lan
# statsd_port: 8125
#
# Note: Most typical deployments override the 'zone' option in the
# 'swift_vars' level to use a unique zone for each storage host.
@ -267,6 +289,23 @@
# store Object PUT replicas on up to 6 disks in region 1 assuming
# replicas is 3, and write_affinity = r1
#
# Option: statsd_host (optional, string)
# Swift supports statsd metrics, this option sets the statsd host that will
# receive statsd metrics.
#
# Option: statsd_port (optional, integer, default 8125)
# Statsd port, requires statsd_host set.
#
# Option: statsd_metric_prefix (optional, string, default ansible_host)
# Specify a prefix that will be prepended to all metrics on this host.
#
# The following statsd related options are a little more complicated and are
# used to tune how many samples are sent to statsd. If you need to tweak these
# settings then first read: http://docs.openstack.org/developer/swift/admin_guide.html
#
# Option: statsd_default_sample_rate (optional, float, default 1.0)
# Option: statsd_sample_rate_factor (optional, float, default 1.0)
#
# Example:
#
# Define three swift proxy hosts:
@ -338,6 +377,23 @@
# Option: weight (optional, integer)
# Weight of all disks.
#
# Option: statsd_host (optional, string)
# Swift supports statsd metrics, this option sets the statsd host that will
# receive statsd metrics.
#
# Option: statsd_port (optional, integer, default 8125)
# Statsd port, requires statsd_host set.
#
# Option: statsd_metric_prefix (optional, string, default ansible_host)
# Specify a prefix that will prepended all metrics on this host.
#
# The following statsd related options are a little more complicated and are
# used to tune how many samples are sent to statsd. If you need to tweak these
# settings then first read: http://docs.openstack.org/developer/swift/admin_guide.html
#
# Option: statsd_default_sample_rate (optional, float, default 1.0)
# Option: statsd_sample_rate_factor (optional, float, default 1.0)
#
# Level: groups (optional)
# List of one of more Ansible groups that apply to this host.
#
@ -411,6 +467,8 @@
# region: 2
# zone: 0
# weight: 200
# statsd_host: statsd2.example.net
# statsd_metric_prefix: swift-node4
# groups:
# - account
# - container

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

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