Stats

Statistics architecture overview.

config.metrics.v2.StatsSink

[config.metrics.v2.StatsSink proto]

Configuration for pluggable stats sinks.

  1. {
  2. "name": "...",
  3. "config": "{...}"
  4. }

name

(string) The name of the stats sink to instantiate. The name must match a supported stats sink. The built-in stats sinks are:

Sinks optionally support tagged/multiple dimensional metrics.

config

(Struct) Stats sink specific configuration which depends on the sink being instantiated. See StatsdSink for an example.

config.metrics.v2.StatsConfig

[config.metrics.v2.StatsConfig proto]

Statistics configuration such as tagging.

  1. {
  2. "stats_tags": [],
  3. "use_all_default_tags": "{...}"
  4. }

stats_tags

(config.metrics.v2.TagSpecifier) Each stat name is iteratively processed through these tag specifiers. When a tag is matched, the first capture group is removed from the name so later TagSpecifiers cannot match that same portion of the match.

use_all_default_tags

(BoolValue) Use all default tag regexes specified in Envoy. These can be combined with custom tags specified in stats_tags. They will be processed before the custom tags.

Note

If any default tags are specified twice, the config will be considered invalid.

See well_known_names.h for a list of the default tags in Envoy.

If not provided, the value is assumed to be true.

config.metrics.v2.TagSpecifier

[config.metrics.v2.TagSpecifier proto]

Designates a tag name and value pair. The value may be either a fixed value or a regex providing the value via capture groups. The specified tag will be unconditionally set if a fixed value, otherwise it will only be set if one or more capture groups in the regex match.

  1. {
  2. "tag_name": "...",
  3. "regex": "...",
  4. "fixed_value": "..."
  5. }

tag_name

(string) Attaches an identifier to the tag values to identify the tag being in the sink. Envoy has a set of default names and regexes to extract dynamic portions of existing stats, which can be found in well_known_names.h in the Envoy repository. If a tag_name is provided in the config and neither regex or fixed_value were specified, Envoy will attempt to find that name in its set of defaults and use the accompanying regex.

Note

It is invalid to specify the same tag name twice in a config.

regex

(string) Designates a tag to strip from the tag extracted name and provide as a named tag value for all statistics. This will only occur if any part of the name matches the regex provided with one or more capture groups.

The first capture group identifies the portion of the name to remove. The second capture group (which will normally be nested inside the first) will designate the value of the tag for the statistic. If no second capture group is provided, the first will also be used to set the value of the tag. All other capture groups will be ignored.

Example 1. a stat name cluster.foo_cluster.upstream_rq_timeout and one tag specifier:

  1. {
  2. "tag_name": "envoy.cluster_name",
  3. "regex": "^cluster\.((.+?)\.)"
  4. }

Note that the regex will remove foo_cluster. making the tag extracted name cluster.upstream_rq_timeout and the tag value for envoy.cluster_name will be foo_cluster (note: there will be no . character because of the second capture group).

Example 2. a stat name http.connection_manager_1.user_agent.ios.downstream_cx_total and two tag specifiers:

  1. [
  2. {
  3. "tag_name": "envoy.http_user_agent",
  4. "regex": "^http(?=\.).*?\.user_agent\.((.+?)\.)\w+?$"
  5. },
  6. {
  7. "tag_name": "envoy.http_conn_manager_prefix",
  8. "regex": "^http\.((.*?)\.)"
  9. }
  10. ]

The two regexes of the specifiers will be processed in the definition order.

The first regex will remove ios., leaving the tag extracted name http.connection_manager_1.user_agent.downstream_cx_total. The tag envoy.http_user_agent will be added with tag value ios.

The second regex will remove connection_manager_1. from the tag extracted name produced by the first regex http.connection_manager_1.user_agent.downstream_cx_total, leaving http.user_agent.downstream_cx_total as the tag extracted name. The tag envoy.http_conn_manager_prefix will be added with the tag value connection_manager_1.

Only one of regex, fixed_value may be set.

fixed_value

(string) Specifies a fixed tag value for the tag_name.

Only one of regex, fixed_value may be set.

config.metrics.v2.StatsdSink

[config.metrics.v2.StatsdSink proto]

Stats configuration proto schema for built-in envoy.statsd sink. This sink does not support tagged metrics.

  1. {
  2. "address": "{...}",
  3. "tcp_cluster_name": "...",
  4. "prefix": "..."
  5. }

address

(core.Address) The UDP address of a running statsd compliant listener. If specified, statistics will be flushed to this address.

Precisely one of address, tcp_cluster_name must be set.

tcp_cluster_name

(string) The name of a cluster that is running a TCP statsd compliant listener. If specified, Envoy will connect to this cluster to flush statistics.

Precisely one of address, tcp_cluster_name must be set.

prefix

(string) Optional custom prefix for StatsdSink. If specified, this will override the default prefix. For example:

  1. {
  2. "prefix" : "envoy-prod"
  3. }

will change emitted stats to

  1. envoy-prod.test_counter:1|c
  2. envoy-prod.test_timer:5|ms

Note that the default prefix, “envoy”, will be used if a prefix is not specified.

Stats with default prefix:

  1. envoy.test_counter:1|c
  2. envoy.test_timer:5|ms

config.metrics.v2.DogStatsdSink

[config.metrics.v2.DogStatsdSink proto]

Stats configuration proto schema for built-in envoy.dog_statsd sink. The sink emits stats with DogStatsD compatible tags. Tags are configurable via StatsConfig.

  1. {
  2. "address": "{...}"
  3. }

address

(core.Address) The UDP address of a running DogStatsD compliant listener. If specified, statistics will be flushed to this address.

Precisely one of address must be set.