metrics.proto 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. // Copyright 2022 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.dashboard.v1;
  16. import "google/api/field_behavior.proto";
  17. import "google/monitoring/dashboard/v1/common.proto";
  18. option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1";
  19. option go_package = "google.golang.org/genproto/googleapis/monitoring/dashboard/v1;dashboard";
  20. option java_multiple_files = true;
  21. option java_outer_classname = "MetricsProto";
  22. option java_package = "com.google.monitoring.dashboard.v1";
  23. option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1";
  24. option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1";
  25. // TimeSeriesQuery collects the set of supported methods for querying time
  26. // series data from the Stackdriver metrics API.
  27. message TimeSeriesQuery {
  28. // Parameters needed to obtain data for the chart.
  29. oneof source {
  30. // Filter parameters to fetch time series.
  31. TimeSeriesFilter time_series_filter = 1;
  32. // Parameters to fetch a ratio between two time series filters.
  33. TimeSeriesFilterRatio time_series_filter_ratio = 2;
  34. // A query used to fetch time series with MQL.
  35. string time_series_query_language = 3;
  36. // A query used to fetch time series with PromQL.
  37. string prometheus_query = 6;
  38. }
  39. // The unit of data contained in fetched time series. If non-empty, this
  40. // unit will override any unit that accompanies fetched data. The format is
  41. // the same as the
  42. // [`unit`](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors)
  43. // field in `MetricDescriptor`.
  44. string unit_override = 5;
  45. }
  46. // A filter that defines a subset of time series data that is displayed in a
  47. // widget. Time series data is fetched using the
  48. // [`ListTimeSeries`](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
  49. // method.
  50. message TimeSeriesFilter {
  51. // Required. The [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
  52. // that identifies the metric types, resources, and projects to query.
  53. string filter = 1 [(google.api.field_behavior) = REQUIRED];
  54. // By default, the raw time series data is returned.
  55. // Use this field to combine multiple time series for different views of the
  56. // data.
  57. Aggregation aggregation = 2;
  58. // Apply a second aggregation after `aggregation` is applied.
  59. Aggregation secondary_aggregation = 3;
  60. // Selects an optional time series filter.
  61. oneof output_filter {
  62. // Ranking based time series filter.
  63. PickTimeSeriesFilter pick_time_series_filter = 4;
  64. // Statistics based time series filter.
  65. // Note: This field is deprecated and completely ignored by the API.
  66. StatisticalTimeSeriesFilter statistical_time_series_filter = 5 [deprecated = true];
  67. }
  68. }
  69. // A pair of time series filters that define a ratio computation. The output
  70. // time series is the pair-wise division of each aligned element from the
  71. // numerator and denominator time series.
  72. message TimeSeriesFilterRatio {
  73. // Describes a query to build the numerator or denominator of a
  74. // TimeSeriesFilterRatio.
  75. message RatioPart {
  76. // Required. The [monitoring
  77. // filter](https://cloud.google.com/monitoring/api/v3/filters) that
  78. // identifies the metric types, resources, and projects to query.
  79. string filter = 1 [(google.api.field_behavior) = REQUIRED];
  80. // By default, the raw time series data is returned.
  81. // Use this field to combine multiple time series for different views of the
  82. // data.
  83. Aggregation aggregation = 2;
  84. }
  85. // The numerator of the ratio.
  86. RatioPart numerator = 1;
  87. // The denominator of the ratio.
  88. RatioPart denominator = 2;
  89. // Apply a second aggregation after the ratio is computed.
  90. Aggregation secondary_aggregation = 3;
  91. // Selects an optional filter that is applied to the time series after
  92. // computing the ratio.
  93. oneof output_filter {
  94. // Ranking based time series filter.
  95. PickTimeSeriesFilter pick_time_series_filter = 4;
  96. // Statistics based time series filter.
  97. // Note: This field is deprecated and completely ignored by the API.
  98. StatisticalTimeSeriesFilter statistical_time_series_filter = 5 [deprecated = true];
  99. }
  100. }
  101. // Defines a threshold for categorizing time series values.
  102. message Threshold {
  103. // The color suggests an interpretation to the viewer when actual values cross
  104. // the threshold. Comments on each color provide UX guidance on how users can
  105. // be expected to interpret a given state color.
  106. enum Color {
  107. // Color is unspecified. Not allowed in well-formed requests.
  108. COLOR_UNSPECIFIED = 0;
  109. // Crossing the threshold is "concerning" behavior.
  110. YELLOW = 4;
  111. // Crossing the threshold is "emergency" behavior.
  112. RED = 6;
  113. }
  114. // Whether the threshold is considered crossed by an actual value above or
  115. // below its threshold value.
  116. enum Direction {
  117. // Not allowed in well-formed requests.
  118. DIRECTION_UNSPECIFIED = 0;
  119. // The threshold will be considered crossed if the actual value is above
  120. // the threshold value.
  121. ABOVE = 1;
  122. // The threshold will be considered crossed if the actual value is below
  123. // the threshold value.
  124. BELOW = 2;
  125. }
  126. // An axis identifier.
  127. enum TargetAxis {
  128. // The target axis was not specified. Defaults to Y1.
  129. TARGET_AXIS_UNSPECIFIED = 0;
  130. // The y_axis (the right axis of chart).
  131. Y1 = 1;
  132. // The y2_axis (the left axis of chart).
  133. Y2 = 2;
  134. }
  135. // A label for the threshold.
  136. string label = 1;
  137. // The value of the threshold. The value should be defined in the native scale
  138. // of the metric.
  139. double value = 2;
  140. // The state color for this threshold. Color is not allowed in a XyChart.
  141. Color color = 3;
  142. // The direction for the current threshold. Direction is not allowed in a
  143. // XyChart.
  144. Direction direction = 4;
  145. // The target axis to use for plotting the threshold. Target axis is not
  146. // allowed in a Scorecard.
  147. TargetAxis target_axis = 5;
  148. }
  149. // Defines the possible types of spark chart supported by the `Scorecard`.
  150. enum SparkChartType {
  151. // Not allowed in well-formed requests.
  152. SPARK_CHART_TYPE_UNSPECIFIED = 0;
  153. // The sparkline will be rendered as a small line chart.
  154. SPARK_LINE = 1;
  155. // The sparkbar will be rendered as a small bar chart.
  156. SPARK_BAR = 2;
  157. }