metric.proto 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. // Copyright 2019 Google LLC.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. //
  15. syntax = "proto3";
  16. package google.api;
  17. import "google/api/label.proto";
  18. import "google/api/launch_stage.proto";
  19. import "google/protobuf/duration.proto";
  20. option go_package = "google.golang.org/genproto/googleapis/api/metric;metric";
  21. option java_multiple_files = true;
  22. option java_outer_classname = "MetricProto";
  23. option java_package = "com.google.api";
  24. option objc_class_prefix = "GAPI";
  25. // Defines a metric type and its schema. Once a metric descriptor is created,
  26. // deleting or altering it stops data collection and makes the metric type's
  27. // existing data unusable.
  28. message MetricDescriptor {
  29. // Additional annotations that can be used to guide the usage of a metric.
  30. message MetricDescriptorMetadata {
  31. // Deprecated. Please use the MetricDescriptor.launch_stage instead.
  32. // The launch stage of the metric definition.
  33. LaunchStage launch_stage = 1 [deprecated = true];
  34. // The sampling period of metric data points. For metrics which are written
  35. // periodically, consecutive data points are stored at this time interval,
  36. // excluding data loss due to errors. Metrics with a higher granularity have
  37. // a smaller sampling period.
  38. google.protobuf.Duration sample_period = 2;
  39. // The delay of data points caused by ingestion. Data points older than this
  40. // age are guaranteed to be ingested and available to be read, excluding
  41. // data loss due to errors.
  42. google.protobuf.Duration ingest_delay = 3;
  43. }
  44. // The kind of measurement. It describes how the data is reported.
  45. enum MetricKind {
  46. // Do not use this default value.
  47. METRIC_KIND_UNSPECIFIED = 0;
  48. // An instantaneous measurement of a value.
  49. GAUGE = 1;
  50. // The change in a value during a time interval.
  51. DELTA = 2;
  52. // A value accumulated over a time interval. Cumulative
  53. // measurements in a time series should have the same start time
  54. // and increasing end times, until an event resets the cumulative
  55. // value to zero and sets a new start time for the following
  56. // points.
  57. CUMULATIVE = 3;
  58. }
  59. // The value type of a metric.
  60. enum ValueType {
  61. // Do not use this default value.
  62. VALUE_TYPE_UNSPECIFIED = 0;
  63. // The value is a boolean.
  64. // This value type can be used only if the metric kind is `GAUGE`.
  65. BOOL = 1;
  66. // The value is a signed 64-bit integer.
  67. INT64 = 2;
  68. // The value is a double precision floating point number.
  69. DOUBLE = 3;
  70. // The value is a text string.
  71. // This value type can be used only if the metric kind is `GAUGE`.
  72. STRING = 4;
  73. // The value is a [`Distribution`][google.api.Distribution].
  74. DISTRIBUTION = 5;
  75. // The value is money.
  76. MONEY = 6;
  77. }
  78. // The resource name of the metric descriptor.
  79. string name = 1;
  80. // The metric type, including its DNS name prefix. The type is not
  81. // URL-encoded. All user-defined metric types have the DNS name
  82. // `custom.googleapis.com` or `external.googleapis.com`. Metric types should
  83. // use a natural hierarchical grouping. For example:
  84. //
  85. // "custom.googleapis.com/invoice/paid/amount"
  86. // "external.googleapis.com/prometheus/up"
  87. // "appengine.googleapis.com/http/server/response_latencies"
  88. string type = 8;
  89. // The set of labels that can be used to describe a specific
  90. // instance of this metric type. For example, the
  91. // `appengine.googleapis.com/http/server/response_latencies` metric
  92. // type has a label for the HTTP response code, `response_code`, so
  93. // you can look at latencies for successful responses or just
  94. // for responses that failed.
  95. repeated LabelDescriptor labels = 2;
  96. // Whether the metric records instantaneous values, changes to a value, etc.
  97. // Some combinations of `metric_kind` and `value_type` might not be supported.
  98. MetricKind metric_kind = 3;
  99. // Whether the measurement is an integer, a floating-point number, etc.
  100. // Some combinations of `metric_kind` and `value_type` might not be supported.
  101. ValueType value_type = 4;
  102. // The unit in which the metric value is reported. It is only applicable
  103. // if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The
  104. // supported units are a subset of [The Unified Code for Units of
  105. // Measure](http://unitsofmeasure.org/ucum.html) standard:
  106. //
  107. // **Basic units (UNIT)**
  108. //
  109. // * `bit` bit
  110. // * `By` byte
  111. // * `s` second
  112. // * `min` minute
  113. // * `h` hour
  114. // * `d` day
  115. //
  116. // **Prefixes (PREFIX)**
  117. //
  118. // * `k` kilo (10**3)
  119. // * `M` mega (10**6)
  120. // * `G` giga (10**9)
  121. // * `T` tera (10**12)
  122. // * `P` peta (10**15)
  123. // * `E` exa (10**18)
  124. // * `Z` zetta (10**21)
  125. // * `Y` yotta (10**24)
  126. // * `m` milli (10**-3)
  127. // * `u` micro (10**-6)
  128. // * `n` nano (10**-9)
  129. // * `p` pico (10**-12)
  130. // * `f` femto (10**-15)
  131. // * `a` atto (10**-18)
  132. // * `z` zepto (10**-21)
  133. // * `y` yocto (10**-24)
  134. // * `Ki` kibi (2**10)
  135. // * `Mi` mebi (2**20)
  136. // * `Gi` gibi (2**30)
  137. // * `Ti` tebi (2**40)
  138. //
  139. // **Grammar**
  140. //
  141. // The grammar also includes these connectors:
  142. //
  143. // * `/` division (as an infix operator, e.g. `1/s`).
  144. // * `.` multiplication (as an infix operator, e.g. `GBy.d`)
  145. //
  146. // The grammar for a unit is as follows:
  147. //
  148. // Expression = Component { "." Component } { "/" Component } ;
  149. //
  150. // Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
  151. // | Annotation
  152. // | "1"
  153. // ;
  154. //
  155. // Annotation = "{" NAME "}" ;
  156. //
  157. // Notes:
  158. //
  159. // * `Annotation` is just a comment if it follows a `UNIT` and is
  160. // equivalent to `1` if it is used alone. For examples,
  161. // `{requests}/s == 1/s`, `By{transmitted}/s == By/s`.
  162. // * `NAME` is a sequence of non-blank printable ASCII characters not
  163. // containing '{' or '}'.
  164. // * `1` represents dimensionless value 1, such as in `1/s`.
  165. // * `%` represents dimensionless value 1/100, and annotates values giving
  166. // a percentage.
  167. string unit = 5;
  168. // A detailed description of the metric, which can be used in documentation.
  169. string description = 6;
  170. // A concise name for the metric, which can be displayed in user interfaces.
  171. // Use sentence case without an ending period, for example "Request count".
  172. // This field is optional but it is recommended to be set for any metrics
  173. // associated with user-visible concepts, such as Quota.
  174. string display_name = 7;
  175. // Optional. Metadata which can be used to guide usage of the metric.
  176. MetricDescriptorMetadata metadata = 10;
  177. // Optional. The launch stage of the metric definition.
  178. LaunchStage launch_stage = 12;
  179. }
  180. // A specific metric, identified by specifying values for all of the
  181. // labels of a [`MetricDescriptor`][google.api.MetricDescriptor].
  182. message Metric {
  183. // An existing metric type, see [google.api.MetricDescriptor][google.api.MetricDescriptor].
  184. // For example, `custom.googleapis.com/invoice/paid/amount`.
  185. string type = 3;
  186. // The set of label values that uniquely identify this metric. All
  187. // labels listed in the `MetricDescriptor` must be assigned values.
  188. map<string, string> labels = 2;
  189. }