stats: API for native labeled metrics

Introduce a LabeledStatsdClient API; no callers yet.

Include three config options:
  - statsd_label_mode, which specifies which label format to use
  - statsd_emit_legacy, which dictates whether to emit old-style
    metrics dotted metrics
  - statsd_user_label_<name> = <value>, which supports user defined
    labels in restricted ASCII characters

Co-Authored-By: yanxiao@nvidia.com
Co-Authored-By: alistairncoles@gmail.com

Change-Id: I115ffb1dc601652a979895d7944e011b951a91c1
This commit is contained in:
Tim Burke
2023-09-29 17:21:08 -07:00
committed by Shreeya Deshpande
parent 05143a99f8
commit 7e5235894b
7 changed files with 986 additions and 63 deletions

View File

@@ -69,6 +69,51 @@ bind_port = 8080
# log_statsd_sample_rate_factor = 1.0
# log_statsd_metric_prefix =
#
# Statsd metrics may include labeling information in a variety of formats.
# Available options:
# disabled, dogstatsd, graphite, influxdb, librato, signalfx.
# Defaults to disabled; enable statsd_label_mode by setting another option.
# See also: https://github.com/prometheus/statsd_exporter#tagging-extensions.
# Note that enabling statsd_label_mode will likely increase the number of time
# series stored, as more labeled metrics may be exposed than may have been
# previously extracted from the dotted non-labeled legacy metric format.
# statsd_label_mode = disabled
#
# Historically, statsd metrics were emitted with implied labels as part of
# metric name in a dotted "legacy" format. Once swift is fully instrumented
# with labeled metrics, and you have statsd_label_mode enabled, you may want to
# turn off legacy metrics; to do that set this option to False. Defaults to
# True.
# statsd_emit_legacy = True
#
# Statsd metrics emitted with labels also support user defined labels
# configured by options. The format for each option is:
# statsd_user_label_<name> = <value>
# where <name> and <value> are restricted to a subset of non-whitespace ASCII
# characters, including letters (upper and lower), numbers and underscores.
# <value> may also contain the period character (.). Each option will add a
# label with name user_<name> and value <value> to labeled metrics.
# User defined labels may be configured in this [DEFAULT] section, in which
# case they will be included with every labeled metric, or they may be
# configured in individual [filter:<middleware>] sections, in which case they
# will only be included with labeled metrics emitted by that <middleware>.
# For example, a proxy-server configuration could use the following to
# delineate labeled metrics emitted by different instances of proxy-logging
# middleware in the pipeline:
# [filter:subrequest-logging]
# use = egg:swift#proxy_logging
# statsd_user_label_reqctx = subrequest
# which adds a label with name 'user_reqctx' and value 'subrequest' to every
# labeled metrics emitted by this proxy-logging instance. This would achieve
# similar effect as the following proxy-server configuration for legacy
# non-labeled metrics:
# [filter:subrequest-logging]
# use = egg:swift#proxy_logging
# access_log_statsd_metric_prefix = subrequest
# Note that the legacy metrics option 'access_log_statsd_metric_prefix' does
# not apply to labeled metrics.
# By default there are no user defined labels.
#
# List of origin hosts that are allowed for CORS requests in addition to what
# the container has set.
# Use a comma separated list of full URL (http://foo.bar:1234,https://foo.bar)