stats: support default tags with fixed value (#416)

Signed-off-by: Taiki Ono <taiks.4559@gmail.com>
pull/419/head
Taiki Ono 7 years ago committed by Matt Klein
parent cc0e23dff3
commit 0811371f17
  1. 125
      api/stats.proto

@ -54,73 +54,86 @@ message StatsConfig {
google.protobuf.BoolValue use_all_default_tags = 2; google.protobuf.BoolValue use_all_default_tags = 2;
} }
// Designates a tag to strip from the tag extracted name and provide as a named // Designates a tag name and value pair. The value may be either a fixed value
// tag value for all statistics. This will only occur if any part of the name // or a regex providing the value via capture groups. The specified tag will be
// matches the regex provided with one or more capture groups. // unconditionally set if a fixed value, otherwise it will only be set if one
// or more capture groups in the regex match.
message TagSpecifier { message TagSpecifier {
// Attaches an identifier to the tag values to identify the tag being in the // 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 // 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 // portions of existing stats, which can be found in `well_known_names.h
// <https://github.com/envoyproxy/envoy/blob/master/source/common/config/well_known_names.h>`_ // <https://github.com/envoyproxy/envoy/blob/master/source/common/config/well_known_names.h>`_
// in the Envoy repository. If a :ref:`tag_name // in the Envoy repository. If a :ref:`tag_name
// <envoy_api_field_TagSpecifier.tag_name>` is provided in the config with an // <envoy_api_field_TagSpecifier.tag_name>` is provided in the config and neither
// empty regex, Envoy will attempt to find that name in its set of defaults // :ref:`regex <envoy_api_field_TagSpecifier.regex>` or
// and use the accompanying regex. // :ref:`fixed_value <envoy_api_field_TagSpecifier.fixed_value>` were specified,
// Envoy will attempt to find that name in its set of defaults and use the accompanying regex.
// //
// .. note:: // .. note::
// //
// If any default tags are specified twice, the config will be considered // It is invalid to specify the same tag name twice in a config.
// invalid.
string tag_name = 1; string tag_name = 1;
// The first capture group identifies the portion of the name to remove. The oneof tag_value {
// second capture group (which will normally be nested inside the first) will // Designates a tag to strip from the tag extracted name and provide as a named
// designate the value of the tag for the statistic. If no second capture // tag value for all statistics. This will only occur if any part of the name
// group is provided, the first will also be used to set the value of the tag. // matches the regex provided with one or more capture groups.
// All other capture groups will be ignored. //
// // The first capture group identifies the portion of the name to remove. The
// Take for example, with a stat name ``cluster.foo_cluster.upstream_rq_timeout`` // second capture group (which will normally be nested inside the first) will
// and // 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.
// .. code-block:: json // All other capture groups will be ignored.
// //
// { // Example 1. a stat name ``cluster.foo_cluster.upstream_rq_timeout`` and
// "tag_name": "envoy.cluster_name", // one tag specifier:
// "regex": "^cluster\.((.+?)\.)" //
// } // .. code-block:: json
// //
// Note that the regex will remove ``foo_cluster.`` making the tag extracted // {
// name ``cluster.upstream_rq_timeout`` and the tag value for // "tag_name": "envoy.cluster_name",
// ``envoy.cluster_name`` will be ``foo_cluster`` (note: there will be no // "regex": "^cluster\.((.+?)\.)"
// ``.`` character because of the second capture group). // }
// //
// An example with two regexes and stat name // Note that the regex will remove ``foo_cluster.`` making the tag extracted
// ``http.connection_manager_1.user_agent.ios.downstream_cx_total``: // name ``cluster.upstream_rq_timeout`` and the tag value for
// // ``envoy.cluster_name`` will be ``foo_cluster`` (note: there will be no
// .. code-block:: json // ``.`` 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_name": "envoy.http_user_agent", // tag specifiers:
// "regex": "^http(?=\.).*?\.user_agent\.((.+?)\.)\w+?$" //
// }, // .. code-block:: json
// { //
// "tag_name": "envoy.http_conn_manager_prefix", // [
// "regex": "^http\.((.*?)\.)" // {
// } // "tag_name": "envoy.http_user_agent",
// ] // "regex": "^http(?=\.).*?\.user_agent\.((.+?)\.)\w+?$"
// // },
// The first regex will remove ``ios.``, leaving the tag extracted name // {
// ``http.connection_manager_1.user_agent.downstream_cx_total``. The tag // "tag_name": "envoy.http_conn_manager_prefix",
// ``envoy.http_user_agent`` will be added with tag value ``ios``. // "regex": "^http\.((.*?)\.)"
// // }
// 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 // The two regexes of the specifiers will be processed in the definition order.
// ``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 // The first regex will remove ``ios.``, leaving the tag extracted name
// ``connection_manager_1``. // ``http.connection_manager_1.user_agent.downstream_cx_total``. The tag
string regex = 2; // ``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``.
string regex = 2;
// Specifies a fixed tag value for the ``tag_name``.
string fixed_value = 3;
}
} }
// Stats configuration proto schema for built-in *envoy.statsd* sink. // Stats configuration proto schema for built-in *envoy.statsd* sink.

Loading…
Cancel
Save