stats.proto 15 KB

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