metric.proto 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. // Copyright 2016 Google Inc.
  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. syntax = "proto3";
  15. package google.api;
  16. import "google/api/label.proto";
  17. option java_multiple_files = true;
  18. option java_outer_classname = "MetricProto";
  19. option java_package = "com.google.api";
  20. option objc_class_prefix = "GAPI";
  21. // Defines a metric type and its schema.
  22. message MetricDescriptor {
  23. // The kind of measurement. It describes how the data is reported.
  24. enum MetricKind {
  25. // Do not use this default value.
  26. METRIC_KIND_UNSPECIFIED = 0;
  27. // An instantaneous measurement of a value.
  28. GAUGE = 1;
  29. // The change in a value during a time interval.
  30. DELTA = 2;
  31. // A value accumulated over a time interval. Cumulative
  32. // measurements in a time series should have the same start time
  33. // and increasing end times, until an event resets the cumulative
  34. // value to zero and sets a new start time for the following
  35. // points.
  36. CUMULATIVE = 3;
  37. }
  38. // The value type of a metric.
  39. enum ValueType {
  40. // Do not use this default value.
  41. VALUE_TYPE_UNSPECIFIED = 0;
  42. // The value is a boolean.
  43. // This value type can be used only if the metric kind is `GAUGE`.
  44. BOOL = 1;
  45. // The value is a signed 64-bit integer.
  46. INT64 = 2;
  47. // The value is a double precision floating point number.
  48. DOUBLE = 3;
  49. // The value is a text string.
  50. // This value type can be used only if the metric kind is `GAUGE`.
  51. STRING = 4;
  52. // The value is a [`Distribution`][google.api.Distribution].
  53. DISTRIBUTION = 5;
  54. // The value is money.
  55. MONEY = 6;
  56. }
  57. // Resource name. The format of the name may vary between different
  58. // implementations. For examples:
  59. //
  60. // projects/{project_id}/metricDescriptors/{type=**}
  61. // metricDescriptors/{type=**}
  62. string name = 1;
  63. // The metric type including a DNS name prefix, for example
  64. // `"compute.googleapis.com/instance/cpu/utilization"`. Metric types
  65. // should use a natural hierarchical grouping such as the following:
  66. //
  67. // compute.googleapis.com/instance/cpu/utilization
  68. // compute.googleapis.com/instance/disk/read_ops_count
  69. // compute.googleapis.com/instance/network/received_bytes_count
  70. //
  71. // Note that if the metric type changes, the monitoring data will be
  72. // discontinued, and anything depends on it will break, such as monitoring
  73. // dashboards, alerting rules and quota limits. Therefore, once a metric has
  74. // been published, its type should be immutable.
  75. string type = 8;
  76. // The set of labels that can be used to describe a specific instance of this
  77. // metric type. For example, the
  78. // `compute.googleapis.com/instance/network/received_bytes_count` metric type
  79. // has a label, `loadbalanced`, that specifies whether the traffic was
  80. // received through a load balanced IP address.
  81. repeated LabelDescriptor labels = 2;
  82. // Whether the metric records instantaneous values, changes to a value, etc.
  83. MetricKind metric_kind = 3;
  84. // Whether the measurement is an integer, a floating-point number, etc.
  85. ValueType value_type = 4;
  86. // The unit in which the metric value is reported. It is only applicable
  87. // if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The
  88. // supported units are a subset of [The Unified Code for Units of
  89. // Measure](http://unitsofmeasure.org/ucum.html) standard:
  90. //
  91. // **Basic units (UNIT)**
  92. //
  93. // * `bit` bit
  94. // * `By` byte
  95. // * `s` second
  96. // * `min` minute
  97. // * `h` hour
  98. // * `d` day
  99. //
  100. // **Prefixes (PREFIX)**
  101. //
  102. // * `k` kilo (10**3)
  103. // * `M` mega (10**6)
  104. // * `G` giga (10**9)
  105. // * `T` tera (10**12)
  106. // * `P` peta (10**15)
  107. // * `E` exa (10**18)
  108. // * `Z` zetta (10**21)
  109. // * `Y` yotta (10**24)
  110. // * `m` milli (10**-3)
  111. // * `u` micro (10**-6)
  112. // * `n` nano (10**-9)
  113. // * `p` pico (10**-12)
  114. // * `f` femto (10**-15)
  115. // * `a` atto (10**-18)
  116. // * `z` zepto (10**-21)
  117. // * `y` yocto (10**-24)
  118. // * `Ki` kibi (2**10)
  119. // * `Mi` mebi (2**20)
  120. // * `Gi` gibi (2**30)
  121. // * `Ti` tebi (2**40)
  122. //
  123. // **Grammar**
  124. //
  125. // The grammar includes the dimensionless unit `1`, such as `1/s`.
  126. //
  127. // The grammar also includes these connectors:
  128. //
  129. // * `/` division (as an infix operator, e.g. `1/s`).
  130. // * `.` multiplication (as an infix operator, e.g. `GBy.d`)
  131. //
  132. // The grammar for a unit is as follows:
  133. //
  134. // Expression = Component { "." Component } { "/" Component } ;
  135. //
  136. // Component = [ PREFIX ] UNIT [ Annotation ]
  137. // | Annotation
  138. // | "1"
  139. // ;
  140. //
  141. // Annotation = "{" NAME "}" ;
  142. //
  143. // Notes:
  144. //
  145. // * `Annotation` is just a comment if it follows a `UNIT` and is
  146. // equivalent to `1` if it is used alone. For examples,
  147. // `{requests}/s == 1/s`, `By{transmitted}/s == By/s`.
  148. // * `NAME` is a sequence of non-blank printable ASCII characters not
  149. // containing '{' or '}'.
  150. string unit = 5;
  151. // A detailed description of the metric, which can be used in documentation.
  152. string description = 6;
  153. // A concise name for the metric, which can be displayed in user interfaces.
  154. // Use sentence case without an ending period, for example "Request count".
  155. string display_name = 7;
  156. }
  157. // A specific metric identified by specifying values for all of the
  158. // labels of a [`MetricDescriptor`][google.api.MetricDescriptor].
  159. message Metric {
  160. // An existing metric type, see [google.api.MetricDescriptor][google.api.MetricDescriptor].
  161. // For example, `compute.googleapis.com/instance/cpu/usage_time`.
  162. string type = 3;
  163. // The set of labels that uniquely identify a metric. To specify a
  164. // metric, all labels enumerated in the `MetricDescriptor` must be
  165. // assigned values.
  166. map<string, string> labels = 2;
  167. }