xref: /aosp_15_r20/external/googleapis/google/monitoring/dashboard/v1/common.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 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
15syntax = "proto3";
16
17package google.monitoring.dashboard.v1;
18
19import "google/protobuf/duration.proto";
20import "google/type/interval.proto";
21
22option csharp_namespace = "Google.Cloud.Monitoring.Dashboard.V1";
23option go_package = "cloud.google.com/go/monitoring/dashboard/apiv1/dashboardpb;dashboardpb";
24option java_multiple_files = true;
25option java_outer_classname = "CommonProto";
26option java_package = "com.google.monitoring.dashboard.v1";
27option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1";
28option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1";
29
30// Describes how to combine multiple time series to provide a different view of
31// the data.  Aggregation of time series is done in two steps. First, each time
32// series in the set is _aligned_ to the same time interval boundaries, then the
33// set of time series is optionally _reduced_ in number.
34//
35// Alignment consists of applying the `per_series_aligner` operation
36// to each time series after its data has been divided into regular
37// `alignment_period` time intervals. This process takes _all_ of the data
38// points in an alignment period, applies a mathematical transformation such as
39// averaging, minimum, maximum, delta, etc., and converts them into a single
40// data point per period.
41//
42// Reduction is when the aligned and transformed time series can optionally be
43// combined, reducing the number of time series through similar mathematical
44// transformations. Reduction involves applying a `cross_series_reducer` to
45// all the time series, optionally sorting the time series into subsets with
46// `group_by_fields`, and applying the reducer to each subset.
47//
48// The raw time series data can contain a huge amount of information from
49// multiple sources. Alignment and reduction transforms this mass of data into
50// a more manageable and representative collection of data, for example "the
51// 95% latency across the average of all tasks in a cluster". This
52// representative data can be more easily graphed and comprehended, and the
53// individual time series data is still available for later drilldown. For more
54// details, see [Filtering and
55// aggregation](https://cloud.google.com/monitoring/api/v3/aggregation).
56message Aggregation {
57  // The `Aligner` specifies the operation that will be applied to the data
58  // points in each alignment period in a time series. Except for
59  // `ALIGN_NONE`, which specifies that no operation be applied, each alignment
60  // operation replaces the set of data values in each alignment period with
61  // a single value: the result of applying the operation to the data values.
62  // An aligned time series has a single data value at the end of each
63  // `alignment_period`.
64  //
65  // An alignment operation can change the data type of the values, too. For
66  // example, if you apply a counting operation to boolean values, the data
67  // `value_type` in the original time series is `BOOLEAN`, but the `value_type`
68  // in the aligned result is `INT64`.
69  enum Aligner {
70    // No alignment. Raw data is returned. Not valid if cross-series reduction
71    // is requested. The `value_type` of the result is the same as the
72    // `value_type` of the input.
73    ALIGN_NONE = 0;
74
75    // Align and convert to
76    // [DELTA][google.api.MetricDescriptor.MetricKind.DELTA].
77    // The output is `delta = y1 - y0`.
78    //
79    // This alignment is valid for
80    // [CUMULATIVE][google.api.MetricDescriptor.MetricKind.CUMULATIVE] and
81    // `DELTA` metrics. If the selected alignment period results in periods
82    // with no data, then the aligned value for such a period is created by
83    // interpolation. The `value_type`  of the aligned result is the same as
84    // the `value_type` of the input.
85    ALIGN_DELTA = 1;
86
87    // Align and convert to a rate. The result is computed as
88    // `rate = (y1 - y0)/(t1 - t0)`, or "delta over time".
89    // Think of this aligner as providing the slope of the line that passes
90    // through the value at the start and at the end of the `alignment_period`.
91    //
92    // This aligner is valid for `CUMULATIVE`
93    // and `DELTA` metrics with numeric values. If the selected alignment
94    // period results in periods with no data, then the aligned value for
95    // such a period is created by interpolation. The output is a `GAUGE`
96    // metric with `value_type` `DOUBLE`.
97    //
98    // If, by "rate", you mean "percentage change", see the
99    // `ALIGN_PERCENT_CHANGE` aligner instead.
100    ALIGN_RATE = 2;
101
102    // Align by interpolating between adjacent points around the alignment
103    // period boundary. This aligner is valid for `GAUGE` metrics with
104    // numeric values. The `value_type` of the aligned result is the same as the
105    // `value_type` of the input.
106    ALIGN_INTERPOLATE = 3;
107
108    // Align by moving the most recent data point before the end of the
109    // alignment period to the boundary at the end of the alignment
110    // period. This aligner is valid for `GAUGE` metrics. The `value_type` of
111    // the aligned result is the same as the `value_type` of the input.
112    ALIGN_NEXT_OLDER = 4;
113
114    // Align the time series by returning the minimum value in each alignment
115    // period. This aligner is valid for `GAUGE` and `DELTA` metrics with
116    // numeric values. The `value_type` of the aligned result is the same as
117    // the `value_type` of the input.
118    ALIGN_MIN = 10;
119
120    // Align the time series by returning the maximum value in each alignment
121    // period. This aligner is valid for `GAUGE` and `DELTA` metrics with
122    // numeric values. The `value_type` of the aligned result is the same as
123    // the `value_type` of the input.
124    ALIGN_MAX = 11;
125
126    // Align the time series by returning the mean value in each alignment
127    // period. This aligner is valid for `GAUGE` and `DELTA` metrics with
128    // numeric values. The `value_type` of the aligned result is `DOUBLE`.
129    ALIGN_MEAN = 12;
130
131    // Align the time series by returning the number of values in each alignment
132    // period. This aligner is valid for `GAUGE` and `DELTA` metrics with
133    // numeric or Boolean values. The `value_type` of the aligned result is
134    // `INT64`.
135    ALIGN_COUNT = 13;
136
137    // Align the time series by returning the sum of the values in each
138    // alignment period. This aligner is valid for `GAUGE` and `DELTA`
139    // metrics with numeric and distribution values. The `value_type` of the
140    // aligned result is the same as the `value_type` of the input.
141    ALIGN_SUM = 14;
142
143    // Align the time series by returning the standard deviation of the values
144    // in each alignment period. This aligner is valid for `GAUGE` and
145    // `DELTA` metrics with numeric values. The `value_type` of the output is
146    // `DOUBLE`.
147    ALIGN_STDDEV = 15;
148
149    // Align the time series by returning the number of `True` values in
150    // each alignment period. This aligner is valid for `GAUGE` metrics with
151    // Boolean values. The `value_type` of the output is `INT64`.
152    ALIGN_COUNT_TRUE = 16;
153
154    // Align the time series by returning the number of `False` values in
155    // each alignment period. This aligner is valid for `GAUGE` metrics with
156    // Boolean values. The `value_type` of the output is `INT64`.
157    ALIGN_COUNT_FALSE = 24;
158
159    // Align the time series by returning the ratio of the number of `True`
160    // values to the total number of values in each alignment period. This
161    // aligner is valid for `GAUGE` metrics with Boolean values. The output
162    // value is in the range [0.0, 1.0] and has `value_type` `DOUBLE`.
163    ALIGN_FRACTION_TRUE = 17;
164
165    // Align the time series by using [percentile
166    // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
167    // data point in each alignment period is the 99th percentile of all data
168    // points in the period. This aligner is valid for `GAUGE` and `DELTA`
169    // metrics with distribution values. The output is a `GAUGE` metric with
170    // `value_type` `DOUBLE`.
171    ALIGN_PERCENTILE_99 = 18;
172
173    // Align the time series by using [percentile
174    // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
175    // data point in each alignment period is the 95th percentile of all data
176    // points in the period. This aligner is valid for `GAUGE` and `DELTA`
177    // metrics with distribution values. The output is a `GAUGE` metric with
178    // `value_type` `DOUBLE`.
179    ALIGN_PERCENTILE_95 = 19;
180
181    // Align the time series by using [percentile
182    // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
183    // data point in each alignment period is the 50th percentile of all data
184    // points in the period. This aligner is valid for `GAUGE` and `DELTA`
185    // metrics with distribution values. The output is a `GAUGE` metric with
186    // `value_type` `DOUBLE`.
187    ALIGN_PERCENTILE_50 = 20;
188
189    // Align the time series by using [percentile
190    // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
191    // data point in each alignment period is the 5th percentile of all data
192    // points in the period. This aligner is valid for `GAUGE` and `DELTA`
193    // metrics with distribution values. The output is a `GAUGE` metric with
194    // `value_type` `DOUBLE`.
195    ALIGN_PERCENTILE_05 = 21;
196
197    // Align and convert to a percentage change. This aligner is valid for
198    // `GAUGE` and `DELTA` metrics with numeric values. This alignment returns
199    // `((current - previous)/previous) * 100`, where the value of `previous` is
200    // determined based on the `alignment_period`.
201    //
202    // If the values of `current` and `previous` are both 0, then the returned
203    // value is 0. If only `previous` is 0, the returned value is infinity.
204    //
205    // A 10-minute moving mean is computed at each point of the alignment period
206    // prior to the above calculation to smooth the metric and prevent false
207    // positives from very short-lived spikes. The moving mean is only
208    // applicable for data whose values are `>= 0`. Any values `< 0` are
209    // treated as a missing datapoint, and are ignored. While `DELTA`
210    // metrics are accepted by this alignment, special care should be taken that
211    // the values for the metric will always be positive. The output is a
212    // `GAUGE` metric with `value_type` `DOUBLE`.
213    ALIGN_PERCENT_CHANGE = 23;
214  }
215
216  // A Reducer operation describes how to aggregate data points from multiple
217  // time series into a single time series, where the value of each data point
218  // in the resulting series is a function of all the already aligned values in
219  // the input time series.
220  enum Reducer {
221    // No cross-time series reduction. The output of the `Aligner` is
222    // returned.
223    REDUCE_NONE = 0;
224
225    // Reduce by computing the mean value across time series for each
226    // alignment period. This reducer is valid for
227    // [DELTA][google.api.MetricDescriptor.MetricKind.DELTA] and
228    // [GAUGE][google.api.MetricDescriptor.MetricKind.GAUGE] metrics with
229    // numeric or distribution values. The `value_type` of the output is
230    // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE].
231    REDUCE_MEAN = 1;
232
233    // Reduce by computing the minimum value across time series for each
234    // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics
235    // with numeric values. The `value_type` of the output is the same as the
236    // `value_type` of the input.
237    REDUCE_MIN = 2;
238
239    // Reduce by computing the maximum value across time series for each
240    // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics
241    // with numeric values. The `value_type` of the output is the same as the
242    // `value_type` of the input.
243    REDUCE_MAX = 3;
244
245    // Reduce by computing the sum across time series for each
246    // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics
247    // with numeric and distribution values. The `value_type` of the output is
248    // the same as the `value_type` of the input.
249    REDUCE_SUM = 4;
250
251    // Reduce by computing the standard deviation across time series
252    // for each alignment period. This reducer is valid for `DELTA` and
253    // `GAUGE` metrics with numeric or distribution values. The `value_type`
254    // of the output is `DOUBLE`.
255    REDUCE_STDDEV = 5;
256
257    // Reduce by computing the number of data points across time series
258    // for each alignment period. This reducer is valid for `DELTA` and
259    // `GAUGE` metrics of numeric, Boolean, distribution, and string
260    // `value_type`. The `value_type` of the output is `INT64`.
261    REDUCE_COUNT = 6;
262
263    // Reduce by computing the number of `True`-valued data points across time
264    // series for each alignment period. This reducer is valid for `DELTA` and
265    // `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output
266    // is `INT64`.
267    REDUCE_COUNT_TRUE = 7;
268
269    // Reduce by computing the number of `False`-valued data points across time
270    // series for each alignment period. This reducer is valid for `DELTA` and
271    // `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output
272    // is `INT64`.
273    REDUCE_COUNT_FALSE = 15;
274
275    // Reduce by computing the ratio of the number of `True`-valued data points
276    // to the total number of data points for each alignment period. This
277    // reducer is valid for `DELTA` and `GAUGE` metrics of Boolean `value_type`.
278    // The output value is in the range [0.0, 1.0] and has `value_type`
279    // `DOUBLE`.
280    REDUCE_FRACTION_TRUE = 8;
281
282    // Reduce by computing the [99th
283    // percentile](https://en.wikipedia.org/wiki/Percentile) of data points
284    // across time series for each alignment period. This reducer is valid for
285    // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
286    // of the output is `DOUBLE`.
287    REDUCE_PERCENTILE_99 = 9;
288
289    // Reduce by computing the [95th
290    // percentile](https://en.wikipedia.org/wiki/Percentile) of data points
291    // across time series for each alignment period. This reducer is valid for
292    // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
293    // of the output is `DOUBLE`.
294    REDUCE_PERCENTILE_95 = 10;
295
296    // Reduce by computing the [50th
297    // percentile](https://en.wikipedia.org/wiki/Percentile) of data points
298    // across time series for each alignment period. This reducer is valid for
299    // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
300    // of the output is `DOUBLE`.
301    REDUCE_PERCENTILE_50 = 11;
302
303    // Reduce by computing the [5th
304    // percentile](https://en.wikipedia.org/wiki/Percentile) of data points
305    // across time series for each alignment period. This reducer is valid for
306    // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
307    // of the output is `DOUBLE`.
308    REDUCE_PERCENTILE_05 = 12;
309  }
310
311  // The `alignment_period` specifies a time interval, in seconds, that is used
312  // to divide the data in all the
313  // [time series][google.monitoring.v3.TimeSeries] into consistent blocks of
314  // time. This will be done before the per-series aligner can be applied to
315  // the data.
316  //
317  // The value must be at least 60 seconds. If a per-series aligner other than
318  // `ALIGN_NONE` is specified, this field is required or an error is returned.
319  // If no per-series aligner is specified, or the aligner `ALIGN_NONE` is
320  // specified, then this field is ignored.
321  //
322  // The maximum value of the `alignment_period` is 2 years, or 104 weeks.
323  google.protobuf.Duration alignment_period = 1;
324
325  // An `Aligner` describes how to bring the data points in a single
326  // time series into temporal alignment. Except for `ALIGN_NONE`, all
327  // alignments cause all the data points in an `alignment_period` to be
328  // mathematically grouped together, resulting in a single data point for
329  // each `alignment_period` with end timestamp at the end of the period.
330  //
331  // Not all alignment operations may be applied to all time series. The valid
332  // choices depend on the `metric_kind` and `value_type` of the original time
333  // series. Alignment can change the `metric_kind` or the `value_type` of
334  // the time series.
335  //
336  // Time series data must be aligned in order to perform cross-time
337  // series reduction. If `cross_series_reducer` is specified, then
338  // `per_series_aligner` must be specified and not equal to `ALIGN_NONE`
339  // and `alignment_period` must be specified; otherwise, an error is
340  // returned.
341  Aligner per_series_aligner = 2;
342
343  // The reduction operation to be used to combine time series into a single
344  // time series, where the value of each data point in the resulting series is
345  // a function of all the already aligned values in the input time series.
346  //
347  // Not all reducer operations can be applied to all time series. The valid
348  // choices depend on the `metric_kind` and the `value_type` of the original
349  // time series. Reduction can yield a time series with a different
350  // `metric_kind` or `value_type` than the input time series.
351  //
352  // Time series data must first be aligned (see `per_series_aligner`) in order
353  // to perform cross-time series reduction. If `cross_series_reducer` is
354  // specified, then `per_series_aligner` must be specified, and must not be
355  // `ALIGN_NONE`. An `alignment_period` must also be specified; otherwise, an
356  // error is returned.
357  Reducer cross_series_reducer = 4;
358
359  // The set of fields to preserve when `cross_series_reducer` is
360  // specified. The `group_by_fields` determine how the time series are
361  // partitioned into subsets prior to applying the aggregation
362  // operation. Each subset contains time series that have the same
363  // value for each of the grouping fields. Each individual time
364  // series is a member of exactly one subset. The
365  // `cross_series_reducer` is applied to each subset of time series.
366  // It is not possible to reduce across different resource types, so
367  // this field implicitly contains `resource.type`.  Fields not
368  // specified in `group_by_fields` are aggregated away.  If
369  // `group_by_fields` is not specified and all the time series have
370  // the same resource type, then the time series are aggregated into
371  // a single output time series. If `cross_series_reducer` is not
372  // defined, this field is ignored.
373  repeated string group_by_fields = 5;
374}
375
376// Describes a ranking-based time series filter. Each input time series is
377// ranked with an aligner. The filter will allow up to `num_time_series` time
378// series to pass through it, selecting them based on the relative ranking.
379//
380// For example, if `ranking_method` is `METHOD_MEAN`,`direction` is `BOTTOM`,
381// and `num_time_series` is 3, then the 3 times series with the lowest mean
382// values will pass through the filter.
383message PickTimeSeriesFilter {
384  // The value reducers that can be applied to a `PickTimeSeriesFilter`.
385  enum Method {
386    // Not allowed. You must specify a different `Method` if you specify a
387    // `PickTimeSeriesFilter`.
388    METHOD_UNSPECIFIED = 0;
389
390    // Select the mean of all values.
391    METHOD_MEAN = 1;
392
393    // Select the maximum value.
394    METHOD_MAX = 2;
395
396    // Select the minimum value.
397    METHOD_MIN = 3;
398
399    // Compute the sum of all values.
400    METHOD_SUM = 4;
401
402    // Select the most recent value.
403    METHOD_LATEST = 5;
404  }
405
406  // Describes the ranking directions.
407  enum Direction {
408    // Not allowed. You must specify a different `Direction` if you specify a
409    // `PickTimeSeriesFilter`.
410    DIRECTION_UNSPECIFIED = 0;
411
412    // Pass the highest `num_time_series` ranking inputs.
413    TOP = 1;
414
415    // Pass the lowest `num_time_series` ranking inputs.
416    BOTTOM = 2;
417  }
418
419  // `ranking_method` is applied to each time series independently to produce
420  // the value which will be used to compare the time series to other time
421  // series.
422  Method ranking_method = 1;
423
424  // How many time series to allow to pass through the filter.
425  int32 num_time_series = 2;
426
427  // How to use the ranking to select time series that pass through the filter.
428  Direction direction = 3;
429
430  // Select the top N streams/time series within this time interval
431  google.type.Interval interval = 4;
432}
433
434// A filter that ranks streams based on their statistical relation to other
435// streams in a request.
436// Note: This field is deprecated and completely ignored by the API.
437message StatisticalTimeSeriesFilter {
438  // The filter methods that can be applied to a stream.
439  enum Method {
440    // Not allowed in well-formed requests.
441    METHOD_UNSPECIFIED = 0;
442
443    // Compute the outlier score of each stream.
444    METHOD_CLUSTER_OUTLIER = 1;
445  }
446
447  // `rankingMethod` is applied to a set of time series, and then the produced
448  // value for each individual time series is used to compare a given time
449  // series to others.
450  // These are methods that cannot be applied stream-by-stream, but rather
451  // require the full context of a request to evaluate time series.
452  Method ranking_method = 1;
453
454  // How many time series to output.
455  int32 num_time_series = 2;
456}
457