1syntax = "proto3"; 2 3package envoy.config.metrics.v3; 4 5import "envoy/config/core/v3/address.proto"; 6import "envoy/type/matcher/v3/string.proto"; 7 8import "google/protobuf/any.proto"; 9import "google/protobuf/wrappers.proto"; 10 11import "udpa/annotations/status.proto"; 12import "udpa/annotations/versioning.proto"; 13import "validate/validate.proto"; 14 15option java_package = "io.envoyproxy.envoy.config.metrics.v3"; 16option java_outer_classname = "StatsProto"; 17option java_multiple_files = true; 18option go_package = "github.com/envoyproxy/go-control-plane/envoy/config/metrics/v3;metricsv3"; 19option (udpa.annotations.file_status).package_version_status = ACTIVE; 20 21// [#protodoc-title: Stats] 22// Statistics :ref:`architecture overview <arch_overview_statistics>`. 23 24// Configuration for pluggable stats sinks. 25message StatsSink { 26 option (udpa.annotations.versioning).previous_message_type = "envoy.config.metrics.v2.StatsSink"; 27 28 reserved 2; 29 30 reserved "config"; 31 32 // The name of the stats sink to instantiate. The name must match a supported 33 // stats sink. 34 // See the :ref:`extensions listed in typed_config below <extension_category_envoy.stats_sinks>` for the default list of available stats sink. 35 // Sinks optionally support tagged/multiple dimensional metrics. 36 string name = 1; 37 38 // Stats sink specific configuration which depends on the sink being instantiated. See 39 // :ref:`StatsdSink <envoy_v3_api_msg_config.metrics.v3.StatsdSink>` for an example. 40 // [#extension-category: envoy.stats_sinks] 41 oneof config_type { 42 google.protobuf.Any typed_config = 3; 43 } 44} 45 46// Statistics configuration such as tagging. 47message StatsConfig { 48 option (udpa.annotations.versioning).previous_message_type = 49 "envoy.config.metrics.v2.StatsConfig"; 50 51 // Each stat name is independently processed through these tag specifiers. When a tag is 52 // matched, the first capture group is not immediately removed from the name, so later 53 // :ref:`TagSpecifiers <envoy_v3_api_msg_config.metrics.v3.TagSpecifier>` can also match that 54 // same portion of the match. After all tag matching is complete, a tag-extracted version of 55 // the name is produced and is used in stats sinks that represent tags, such as Prometheus. 56 repeated TagSpecifier stats_tags = 1; 57 58 // Use all default tag regexes specified in Envoy. These can be combined with 59 // custom tags specified in :ref:`stats_tags 60 // <envoy_v3_api_field_config.metrics.v3.StatsConfig.stats_tags>`. They will be processed before 61 // the custom tags. 62 // 63 // .. note:: 64 // 65 // If any default tags are specified twice, the config will be considered 66 // invalid. 67 // 68 // See :repo:`well_known_names.h <source/common/config/well_known_names.h>` for a list of the 69 // default tags in Envoy. 70 // 71 // If not provided, the value is assumed to be true. 72 google.protobuf.BoolValue use_all_default_tags = 2; 73 74 // Inclusion/exclusion matcher for stat name creation. If not provided, all stats are instantiated 75 // as normal. Preventing the instantiation of certain families of stats can improve memory 76 // performance for Envoys running especially large configs. 77 // 78 // .. warning:: 79 // Excluding stats may affect Envoy's behavior in undocumented ways. See 80 // `issue #8771 <https://github.com/envoyproxy/envoy/issues/8771>`_ for more information. 81 // If any unexpected behavior changes are observed, please open a new issue immediately. 82 StatsMatcher stats_matcher = 3; 83 84 // Defines rules for setting the histogram buckets. Rules are evaluated in order, and the first 85 // match is applied. If no match is found (or if no rules are set), the following default buckets 86 // are used: 87 // 88 // .. code-block:: json 89 // 90 // [ 91 // 0.5, 92 // 1, 93 // 5, 94 // 10, 95 // 25, 96 // 50, 97 // 100, 98 // 250, 99 // 500, 100 // 1000, 101 // 2500, 102 // 5000, 103 // 10000, 104 // 30000, 105 // 60000, 106 // 300000, 107 // 600000, 108 // 1800000, 109 // 3600000 110 // ] 111 repeated HistogramBucketSettings histogram_bucket_settings = 4; 112} 113 114// Configuration for disabling stat instantiation. 115message StatsMatcher { 116 // The instantiation of stats is unrestricted by default. If the goal is to configure Envoy to 117 // instantiate all stats, there is no need to construct a StatsMatcher. 118 // 119 // However, StatsMatcher can be used to limit the creation of families of stats in order to 120 // conserve memory. Stats can either be disabled entirely, or they can be 121 // limited by either an exclusion or an inclusion list of :ref:`StringMatcher 122 // <envoy_v3_api_msg_type.matcher.v3.StringMatcher>` protos: 123 // 124 // * If ``reject_all`` is set to `true`, no stats will be instantiated. If ``reject_all`` is set to 125 // `false`, all stats will be instantiated. 126 // 127 // * If an exclusion list is supplied, any stat name matching *any* of the StringMatchers in the 128 // list will not instantiate. 129 // 130 // * If an inclusion list is supplied, no stats will instantiate, except those matching *any* of 131 // the StringMatchers in the list. 132 // 133 // 134 // A StringMatcher can be used to match against an exact string, a suffix / prefix, or a regex. 135 // **NB:** For performance reasons, it is highly recommended to use a prefix- or suffix-based 136 // matcher rather than a regex-based matcher. 137 // 138 // Example 1. Excluding all stats. 139 // 140 // .. code-block:: json 141 // 142 // { 143 // "statsMatcher": { 144 // "rejectAll": "true" 145 // } 146 // } 147 // 148 // Example 2. Excluding all cluster-specific stats, but not cluster-manager stats: 149 // 150 // .. code-block:: json 151 // 152 // { 153 // "statsMatcher": { 154 // "exclusionList": { 155 // "patterns": [ 156 // { 157 // "prefix": "cluster." 158 // } 159 // ] 160 // } 161 // } 162 // } 163 // 164 // Example 3. Including only manager-related stats: 165 // 166 // .. code-block:: json 167 // 168 // { 169 // "statsMatcher": { 170 // "inclusionList": { 171 // "patterns": [ 172 // { 173 // "prefix": "cluster_manager." 174 // }, 175 // { 176 // "prefix": "listener_manager." 177 // } 178 // ] 179 // } 180 // } 181 // } 182 // 183 184 option (udpa.annotations.versioning).previous_message_type = 185 "envoy.config.metrics.v2.StatsMatcher"; 186 187 oneof stats_matcher { 188 option (validate.required) = true; 189 190 // If ``reject_all`` is true, then all stats are disabled. If ``reject_all`` is false, then all 191 // stats are enabled. 192 bool reject_all = 1; 193 194 // Exclusive match. All stats are enabled except for those matching one of the supplied 195 // StringMatcher protos. 196 type.matcher.v3.ListStringMatcher exclusion_list = 2; 197 198 // Inclusive match. No stats are enabled except for those matching one of the supplied 199 // StringMatcher protos. 200 type.matcher.v3.ListStringMatcher inclusion_list = 3; 201 } 202} 203 204// Designates a tag name and value pair. The value may be either a fixed value 205// or a regex providing the value via capture groups. The specified tag will be 206// unconditionally set if a fixed value, otherwise it will only be set if one 207// or more capture groups in the regex match. 208message TagSpecifier { 209 option (udpa.annotations.versioning).previous_message_type = 210 "envoy.config.metrics.v2.TagSpecifier"; 211 212 // Attaches an identifier to the tag values to identify the tag being in the 213 // sink. Envoy has a set of default names and regexes to extract dynamic 214 // portions of existing stats, which can be found in :repo:`well_known_names.h 215 // <source/common/config/well_known_names.h>` in the Envoy repository. If a :ref:`tag_name 216 // <envoy_v3_api_field_config.metrics.v3.TagSpecifier.tag_name>` is provided in the config and 217 // neither :ref:`regex <envoy_v3_api_field_config.metrics.v3.TagSpecifier.regex>` or 218 // :ref:`fixed_value <envoy_v3_api_field_config.metrics.v3.TagSpecifier.fixed_value>` were specified, 219 // Envoy will attempt to find that name in its set of defaults and use the accompanying regex. 220 // 221 // .. note:: 222 // 223 // A stat name may be spelled in such a way that it matches two different 224 // tag extractors for the same tag name. In that case, all but one of the 225 // tag values will be dropped. It is not specified which tag value will be 226 // retained. The extraction will only occur for one of the extractors, and 227 // only the matched extraction will be removed from the tag name. 228 string tag_name = 1; 229 230 oneof tag_value { 231 // Designates a tag to strip from the tag extracted name and provide as a named 232 // tag value for all statistics. This will only occur if any part of the name 233 // matches the regex provided with one or more capture groups. 234 // 235 // The first capture group identifies the portion of the name to remove. The 236 // second capture group (which will normally be nested inside the first) will 237 // designate the value of the tag for the statistic. If no second capture 238 // group is provided, the first will also be used to set the value of the tag. 239 // All other capture groups will be ignored. 240 // 241 // Example 1. a stat name ``cluster.foo_cluster.upstream_rq_timeout`` and 242 // one tag specifier: 243 // 244 // .. code-block:: json 245 // 246 // { 247 // "tag_name": "envoy.cluster_name", 248 // "regex": "^cluster\\.((.+?)\\.)" 249 // } 250 // 251 // Note that the regex will remove ``foo_cluster.`` making the tag extracted 252 // name ``cluster.upstream_rq_timeout`` and the tag value for 253 // ``envoy.cluster_name`` will be ``foo_cluster`` (note: there will be no 254 // ``.`` character because of the second capture group). 255 // 256 // Example 2. a stat name 257 // ``http.connection_manager_1.user_agent.ios.downstream_cx_total`` and two 258 // tag specifiers: 259 // 260 // .. code-block:: json 261 // 262 // [ 263 // { 264 // "tag_name": "envoy.http_user_agent", 265 // "regex": "^http(?=\\.).*?\\.user_agent\\.((.+?)\\.)\\w+?$" 266 // }, 267 // { 268 // "tag_name": "envoy.http_conn_manager_prefix", 269 // "regex": "^http\\.((.*?)\\.)" 270 // } 271 // ] 272 // 273 // The two regexes of the specifiers will be processed from the elaborated 274 // stat name. 275 // 276 // The first regex will save ``ios.`` as the tag value for ``envoy.http_user_agent``. It will 277 // leave it in the name for potential matching with additional tag specifiers. After all tag 278 // specifiers are processed the tags will be removed from the name. 279 // 280 // The second regex will populate tag ``envoy.http_conn_manager_prefix`` with value 281 // ``connection_manager_1.``, based on the original stat name. 282 // 283 // As a final step, the matched tags are removed, leaving 284 // ``http.user_agent.downstream_cx_total`` as the tag extracted name. 285 string regex = 2 [(validate.rules).string = {max_bytes: 1024}]; 286 287 // Specifies a fixed tag value for the ``tag_name``. 288 string fixed_value = 3; 289 } 290} 291 292// Specifies a matcher for stats and the buckets that matching stats should use. 293message HistogramBucketSettings { 294 // The stats that this rule applies to. The match is applied to the original stat name 295 // before tag-extraction, for example ``cluster.exampleclustername.upstream_cx_length_ms``. 296 type.matcher.v3.StringMatcher match = 1 [(validate.rules).message = {required: true}]; 297 298 // Each value is the upper bound of a bucket. Each bucket must be greater than 0 and unique. 299 // The order of the buckets does not matter. 300 repeated double buckets = 2 [(validate.rules).repeated = { 301 min_items: 1 302 unique: true 303 items {double {gt: 0.0}} 304 }]; 305} 306 307// Stats configuration proto schema for built-in ``envoy.stat_sinks.statsd`` sink. This sink does not support 308// tagged metrics. 309// [#extension: envoy.stat_sinks.statsd] 310message StatsdSink { 311 option (udpa.annotations.versioning).previous_message_type = "envoy.config.metrics.v2.StatsdSink"; 312 313 oneof statsd_specifier { 314 option (validate.required) = true; 315 316 // The UDP address of a running `statsd <https://github.com/etsy/statsd>`_ 317 // compliant listener. If specified, statistics will be flushed to this 318 // address. 319 core.v3.Address address = 1; 320 321 // The name of a cluster that is running a TCP `statsd 322 // <https://github.com/etsy/statsd>`_ compliant listener. If specified, 323 // Envoy will connect to this cluster to flush statistics. 324 string tcp_cluster_name = 2; 325 } 326 327 // Optional custom prefix for StatsdSink. If 328 // specified, this will override the default prefix. 329 // For example: 330 // 331 // .. code-block:: json 332 // 333 // { 334 // "prefix" : "envoy-prod" 335 // } 336 // 337 // will change emitted stats to 338 // 339 // .. code-block:: cpp 340 // 341 // envoy-prod.test_counter:1|c 342 // envoy-prod.test_timer:5|ms 343 // 344 // Note that the default prefix, "envoy", will be used if a prefix is not 345 // specified. 346 // 347 // Stats with default prefix: 348 // 349 // .. code-block:: cpp 350 // 351 // envoy.test_counter:1|c 352 // envoy.test_timer:5|ms 353 string prefix = 3; 354} 355 356// Stats configuration proto schema for built-in ``envoy.stat_sinks.dog_statsd`` sink. 357// The sink emits stats with `DogStatsD <https://docs.datadoghq.com/guides/dogstatsd/>`_ 358// compatible tags. Tags are configurable via :ref:`StatsConfig 359// <envoy_v3_api_msg_config.metrics.v3.StatsConfig>`. 360// [#extension: envoy.stat_sinks.dog_statsd] 361message DogStatsdSink { 362 option (udpa.annotations.versioning).previous_message_type = 363 "envoy.config.metrics.v2.DogStatsdSink"; 364 365 reserved 2; 366 367 oneof dog_statsd_specifier { 368 option (validate.required) = true; 369 370 // The UDP address of a running DogStatsD compliant listener. If specified, 371 // statistics will be flushed to this address. 372 core.v3.Address address = 1; 373 } 374 375 // Optional custom metric name prefix. See :ref:`StatsdSink's prefix field 376 // <envoy_v3_api_field_config.metrics.v3.StatsdSink.prefix>` for more details. 377 string prefix = 3; 378 379 // Optional max datagram size to use when sending UDP messages. By default Envoy 380 // will emit one metric per datagram. By specifying a max-size larger than a single 381 // metric, Envoy will emit multiple, new-line separated metrics. The max datagram 382 // size should not exceed your network's MTU. 383 // 384 // Note that this value may not be respected if smaller than a single metric. 385 google.protobuf.UInt64Value max_bytes_per_datagram = 4 [(validate.rules).uint64 = {gt: 0}]; 386} 387 388// Stats configuration proto schema for built-in ``envoy.stat_sinks.hystrix`` sink. 389// The sink emits stats in `text/event-stream 390// <https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events>`_ 391// formatted stream for use by `Hystrix dashboard 392// <https://github.com/Netflix-Skunkworks/hystrix-dashboard/wiki>`_. 393// 394// Note that only a single HystrixSink should be configured. 395// 396// Streaming is started through an admin endpoint :http:get:`/hystrix_event_stream`. 397// [#extension: envoy.stat_sinks.hystrix] 398message HystrixSink { 399 option (udpa.annotations.versioning).previous_message_type = 400 "envoy.config.metrics.v2.HystrixSink"; 401 402 // The number of buckets the rolling statistical window is divided into. 403 // 404 // Each time the sink is flushed, all relevant Envoy statistics are sampled and 405 // added to the rolling window (removing the oldest samples in the window 406 // in the process). The sink then outputs the aggregate statistics across the 407 // current rolling window to the event stream(s). 408 // 409 // ``rolling_window(ms)`` = ``stats_flush_interval(ms)`` * ``num_of_buckets`` 410 // 411 // More detailed explanation can be found in `Hystrix wiki 412 // <https://github.com/Netflix/Hystrix/wiki/Metrics-and-Monitoring#hystrixrollingnumber>`_. 413 int64 num_buckets = 1; 414} 415