metric.proto 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. // Copyright 2021 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. syntax = "proto3";
  15. package google.monitoring.v3;
  16. import "google/api/label.proto";
  17. import "google/api/metric.proto";
  18. import "google/api/monitored_resource.proto";
  19. import "google/monitoring/v3/common.proto";
  20. option csharp_namespace = "Google.Cloud.Monitoring.V3";
  21. option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring";
  22. option java_multiple_files = true;
  23. option java_outer_classname = "MetricProto";
  24. option java_package = "com.google.monitoring.v3";
  25. option php_namespace = "Google\\Cloud\\Monitoring\\V3";
  26. option ruby_package = "Google::Cloud::Monitoring::V3";
  27. // A single data point in a time series.
  28. message Point {
  29. // The time interval to which the data point applies. For `GAUGE` metrics,
  30. // the start time is optional, but if it is supplied, it must equal the
  31. // end time. For `DELTA` metrics, the start
  32. // and end time should specify a non-zero interval, with subsequent points
  33. // specifying contiguous and non-overlapping intervals. For `CUMULATIVE`
  34. // metrics, the start and end time should specify a non-zero interval, with
  35. // subsequent points specifying the same start time and increasing end times,
  36. // until an event resets the cumulative value to zero and sets a new start
  37. // time for the following points.
  38. TimeInterval interval = 1;
  39. // The value of the data point.
  40. TypedValue value = 2;
  41. }
  42. // A collection of data points that describes the time-varying values
  43. // of a metric. A time series is identified by a combination of a
  44. // fully-specified monitored resource and a fully-specified metric.
  45. // This type is used for both listing and creating time series.
  46. message TimeSeries {
  47. // The associated metric. A fully-specified metric used to identify the time
  48. // series.
  49. google.api.Metric metric = 1;
  50. // The associated monitored resource. Custom metrics can use only certain
  51. // monitored resource types in their time series data. For more information,
  52. // see [Monitored resources for custom
  53. // metrics](https://cloud.google.com/monitoring/custom-metrics/creating-metrics#custom-metric-resources).
  54. google.api.MonitoredResource resource = 2;
  55. // Output only. The associated monitored resource metadata. When reading a
  56. // time series, this field will include metadata labels that are explicitly
  57. // named in the reduction. When creating a time series, this field is ignored.
  58. google.api.MonitoredResourceMetadata metadata = 7;
  59. // The metric kind of the time series. When listing time series, this metric
  60. // kind might be different from the metric kind of the associated metric if
  61. // this time series is an alignment or reduction of other time series.
  62. //
  63. // When creating a time series, this field is optional. If present, it must be
  64. // the same as the metric kind of the associated metric. If the associated
  65. // metric's descriptor must be auto-created, then this field specifies the
  66. // metric kind of the new descriptor and must be either `GAUGE` (the default)
  67. // or `CUMULATIVE`.
  68. google.api.MetricDescriptor.MetricKind metric_kind = 3;
  69. // The value type of the time series. When listing time series, this value
  70. // type might be different from the value type of the associated metric if
  71. // this time series is an alignment or reduction of other time series.
  72. //
  73. // When creating a time series, this field is optional. If present, it must be
  74. // the same as the type of the data in the `points` field.
  75. google.api.MetricDescriptor.ValueType value_type = 4;
  76. // The data points of this time series. When listing time series, points are
  77. // returned in reverse time order.
  78. //
  79. // When creating a time series, this field must contain exactly one point and
  80. // the point's type must be the same as the value type of the associated
  81. // metric. If the associated metric's descriptor must be auto-created, then
  82. // the value type of the descriptor is determined by the point's type, which
  83. // must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`.
  84. repeated Point points = 5;
  85. // The units in which the metric value is reported. It is only applicable
  86. // if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
  87. // defines the representation of the stored metric values.
  88. string unit = 8;
  89. }
  90. // A descriptor for the labels and points in a time series.
  91. message TimeSeriesDescriptor {
  92. // A descriptor for the value columns in a data point.
  93. message ValueDescriptor {
  94. // The value key.
  95. string key = 1;
  96. // The value type.
  97. google.api.MetricDescriptor.ValueType value_type = 2;
  98. // The value stream kind.
  99. google.api.MetricDescriptor.MetricKind metric_kind = 3;
  100. // The unit in which `time_series` point values are reported. `unit`
  101. // follows the UCUM format for units as seen in
  102. // https://unitsofmeasure.org/ucum.html.
  103. // `unit` is only valid if `value_type` is INTEGER, DOUBLE, DISTRIBUTION.
  104. string unit = 4;
  105. }
  106. // Descriptors for the labels.
  107. repeated google.api.LabelDescriptor label_descriptors = 1;
  108. // Descriptors for the point data value columns.
  109. repeated ValueDescriptor point_descriptors = 5;
  110. }
  111. // Represents the values of a time series associated with a
  112. // TimeSeriesDescriptor.
  113. message TimeSeriesData {
  114. // A point's value columns and time interval. Each point has one or more
  115. // point values corresponding to the entries in `point_descriptors` field in
  116. // the TimeSeriesDescriptor associated with this object.
  117. message PointData {
  118. // The values that make up the point.
  119. repeated TypedValue values = 1;
  120. // The time interval associated with the point.
  121. TimeInterval time_interval = 2;
  122. }
  123. // The values of the labels in the time series identifier, given in the same
  124. // order as the `label_descriptors` field of the TimeSeriesDescriptor
  125. // associated with this object. Each value must have a value of the type
  126. // given in the corresponding entry of `label_descriptors`.
  127. repeated LabelValue label_values = 1;
  128. // The points in the time series.
  129. repeated PointData point_data = 2;
  130. }
  131. // A label value.
  132. message LabelValue {
  133. // The label value can be a bool, int64, or string.
  134. oneof value {
  135. // A bool label value.
  136. bool bool_value = 1;
  137. // An int64 label value.
  138. int64 int64_value = 2;
  139. // A string label value.
  140. string string_value = 3;
  141. }
  142. }
  143. // An error associated with a query in the time series query language format.
  144. message QueryError {
  145. // The location of the time series query language text that this error applies
  146. // to.
  147. TextLocator locator = 1;
  148. // The error message.
  149. string message = 2;
  150. }
  151. // A locator for text. Indicates a particular part of the text of a request or
  152. // of an object referenced in the request.
  153. //
  154. // For example, suppose the request field `text` contains:
  155. //
  156. // text: "The quick brown fox jumps over the lazy dog."
  157. //
  158. // Then the locator:
  159. //
  160. // source: "text"
  161. // start_position {
  162. // line: 1
  163. // column: 17
  164. // }
  165. // end_position {
  166. // line: 1
  167. // column: 19
  168. // }
  169. //
  170. // refers to the part of the text: "fox".
  171. message TextLocator {
  172. // The position of a byte within the text.
  173. message Position {
  174. // The line, starting with 1, where the byte is positioned.
  175. int32 line = 1;
  176. // The column within the line, starting with 1, where the byte is
  177. // positioned. This is a byte index even though the text is UTF-8.
  178. int32 column = 2;
  179. }
  180. // The source of the text. The source may be a field in the request, in which
  181. // case its format is the format of the
  182. // google.rpc.BadRequest.FieldViolation.field field in
  183. // https://cloud.google.com/apis/design/errors#error_details. It may also be
  184. // be a source other than the request field (e.g. a macro definition
  185. // referenced in the text of the query), in which case this is the name of
  186. // the source (e.g. the macro name).
  187. string source = 1;
  188. // The position of the first byte within the text.
  189. Position start_position = 2;
  190. // The position of the last byte within the text.
  191. Position end_position = 3;
  192. // If `source`, `start_position`, and `end_position` describe a call on
  193. // some object (e.g. a macro in the time series query language text) and a
  194. // location is to be designated in that object's text, `nested_locator`
  195. // identifies the location within that object.
  196. TextLocator nested_locator = 4;
  197. // When `nested_locator` is set, this field gives the reason for the nesting.
  198. // Usually, the reason is a macro invocation. In that case, the macro name
  199. // (including the leading '@') signals the location of the macro call
  200. // in the text and a macro argument name (including the leading '$') signals
  201. // the location of the macro argument inside the macro body that got
  202. // substituted away.
  203. string nesting_reason = 5;
  204. }