xref: /aosp_15_r20/external/googleapis/google/monitoring/v3/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.v3;
18
19import "google/api/distribution.proto";
20import "google/protobuf/duration.proto";
21import "google/protobuf/timestamp.proto";
22
23option csharp_namespace = "Google.Cloud.Monitoring.V3";
24option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
25option java_multiple_files = true;
26option java_outer_classname = "CommonProto";
27option java_package = "com.google.monitoring.v3";
28option objc_class_prefix = "GMON";
29option php_namespace = "Google\\Cloud\\Monitoring\\V3";
30option ruby_package = "Google::Cloud::Monitoring::V3";
31
32// A single strongly-typed value.
33message TypedValue {
34  // The typed value field.
35  oneof value {
36    // A Boolean value: `true` or `false`.
37    bool bool_value = 1;
38
39    // A 64-bit integer. Its range is approximately &plusmn;9.2x10<sup>18</sup>.
40    int64 int64_value = 2;
41
42    // A 64-bit double-precision floating-point number. Its magnitude
43    // is approximately &plusmn;10<sup>&plusmn;300</sup> and it has 16
44    // significant digits of precision.
45    double double_value = 3;
46
47    // A variable-length string value.
48    string string_value = 4;
49
50    // A distribution value.
51    google.api.Distribution distribution_value = 5;
52  }
53}
54
55// Describes a time interval:
56//
57//   * Reads: A half-open time interval. It includes the end time but
58//     excludes the start time: `(startTime, endTime]`. The start time
59//     must be specified, must be earlier than the end time, and should be
60//     no older than the data retention period for the metric.
61//   * Writes: A closed time interval. It extends from the start time to the end
62//   time,
63//     and includes both: `[startTime, endTime]`. Valid time intervals
64//     depend on the
65//     [`MetricKind`](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors#MetricKind)
66//     of the metric value. The end time must not be earlier than the start
67//     time, and the end time must not be more than 25 hours in the past or more
68//     than five minutes in the future.
69//     * For `GAUGE` metrics, the `startTime` value is technically optional; if
70//       no value is specified, the start time defaults to the value of the
71//       end time, and the interval represents a single point in time. If both
72//       start and end times are specified, they must be identical. Such an
73//       interval is valid only for `GAUGE` metrics, which are point-in-time
74//       measurements. The end time of a new interval must be at least a
75//       millisecond after the end time of the previous interval.
76//     * For `DELTA` metrics, the start time and end time must specify a
77//       non-zero interval, with subsequent points specifying contiguous and
78//       non-overlapping intervals. For `DELTA` metrics, the start time of
79//       the next interval must be at least a millisecond after the end time
80//       of the previous interval.
81//     * For `CUMULATIVE` metrics, the start time and end time must specify a
82//       non-zero interval, with subsequent points specifying the same
83//       start time and increasing end times, until an event resets the
84//       cumulative value to zero and sets a new start time for the following
85//       points. The new start time must be at least a millisecond after the
86//       end time of the previous interval.
87//     * The start time of a new interval must be at least a millisecond after
88//     the
89//       end time of the previous interval because intervals are closed. If the
90//       start time of a new interval is the same as the end time of the
91//       previous interval, then data written at the new start time could
92//       overwrite data written at the previous end time.
93message TimeInterval {
94  // Required. The end of the time interval.
95  google.protobuf.Timestamp end_time = 2;
96
97  // Optional. The beginning of the time interval.  The default value
98  // for the start time is the end time. The start time must not be
99  // later than the end time.
100  google.protobuf.Timestamp start_time = 1;
101}
102
103// Describes how to combine multiple time series to provide a different view of
104// the data.  Aggregation of time series is done in two steps. First, each time
105// series in the set is _aligned_ to the same time interval boundaries, then the
106// set of time series is optionally _reduced_ in number.
107//
108// Alignment consists of applying the `per_series_aligner` operation
109// to each time series after its data has been divided into regular
110// `alignment_period` time intervals. This process takes _all_ of the data
111// points in an alignment period, applies a mathematical transformation such as
112// averaging, minimum, maximum, delta, etc., and converts them into a single
113// data point per period.
114//
115// Reduction is when the aligned and transformed time series can optionally be
116// combined, reducing the number of time series through similar mathematical
117// transformations. Reduction involves applying a `cross_series_reducer` to
118// all the time series, optionally sorting the time series into subsets with
119// `group_by_fields`, and applying the reducer to each subset.
120//
121// The raw time series data can contain a huge amount of information from
122// multiple sources. Alignment and reduction transforms this mass of data into
123// a more manageable and representative collection of data, for example "the
124// 95% latency across the average of all tasks in a cluster". This
125// representative data can be more easily graphed and comprehended, and the
126// individual time series data is still available for later drilldown. For more
127// details, see [Filtering and
128// aggregation](https://cloud.google.com/monitoring/api/v3/aggregation).
129message Aggregation {
130  // The `Aligner` specifies the operation that will be applied to the data
131  // points in each alignment period in a time series. Except for
132  // `ALIGN_NONE`, which specifies that no operation be applied, each alignment
133  // operation replaces the set of data values in each alignment period with
134  // a single value: the result of applying the operation to the data values.
135  // An aligned time series has a single data value at the end of each
136  // `alignment_period`.
137  //
138  // An alignment operation can change the data type of the values, too. For
139  // example, if you apply a counting operation to boolean values, the data
140  // `value_type` in the original time series is `BOOLEAN`, but the `value_type`
141  // in the aligned result is `INT64`.
142  enum Aligner {
143    // No alignment. Raw data is returned. Not valid if cross-series reduction
144    // is requested. The `value_type` of the result is the same as the
145    // `value_type` of the input.
146    ALIGN_NONE = 0;
147
148    // Align and convert to
149    // [DELTA][google.api.MetricDescriptor.MetricKind.DELTA].
150    // The output is `delta = y1 - y0`.
151    //
152    // This alignment is valid for
153    // [CUMULATIVE][google.api.MetricDescriptor.MetricKind.CUMULATIVE] and
154    // `DELTA` metrics. If the selected alignment period results in periods
155    // with no data, then the aligned value for such a period is created by
156    // interpolation. The `value_type`  of the aligned result is the same as
157    // the `value_type` of the input.
158    ALIGN_DELTA = 1;
159
160    // Align and convert to a rate. The result is computed as
161    // `rate = (y1 - y0)/(t1 - t0)`, or "delta over time".
162    // Think of this aligner as providing the slope of the line that passes
163    // through the value at the start and at the end of the `alignment_period`.
164    //
165    // This aligner is valid for `CUMULATIVE`
166    // and `DELTA` metrics with numeric values. If the selected alignment
167    // period results in periods with no data, then the aligned value for
168    // such a period is created by interpolation. The output is a `GAUGE`
169    // metric with `value_type` `DOUBLE`.
170    //
171    // If, by "rate", you mean "percentage change", see the
172    // `ALIGN_PERCENT_CHANGE` aligner instead.
173    ALIGN_RATE = 2;
174
175    // Align by interpolating between adjacent points around the alignment
176    // period boundary. This aligner is valid for `GAUGE` metrics with
177    // numeric values. The `value_type` of the aligned result is the same as the
178    // `value_type` of the input.
179    ALIGN_INTERPOLATE = 3;
180
181    // Align by moving the most recent data point before the end of the
182    // alignment period to the boundary at the end of the alignment
183    // period. This aligner is valid for `GAUGE` metrics. The `value_type` of
184    // the aligned result is the same as the `value_type` of the input.
185    ALIGN_NEXT_OLDER = 4;
186
187    // Align the time series by returning the minimum value in each alignment
188    // period. This aligner is valid for `GAUGE` and `DELTA` metrics with
189    // numeric values. The `value_type` of the aligned result is the same as
190    // the `value_type` of the input.
191    ALIGN_MIN = 10;
192
193    // Align the time series by returning the maximum value in each alignment
194    // period. This aligner is valid for `GAUGE` and `DELTA` metrics with
195    // numeric values. The `value_type` of the aligned result is the same as
196    // the `value_type` of the input.
197    ALIGN_MAX = 11;
198
199    // Align the time series by returning the mean value in each alignment
200    // period. This aligner is valid for `GAUGE` and `DELTA` metrics with
201    // numeric values. The `value_type` of the aligned result is `DOUBLE`.
202    ALIGN_MEAN = 12;
203
204    // Align the time series by returning the number of values in each alignment
205    // period. This aligner is valid for `GAUGE` and `DELTA` metrics with
206    // numeric or Boolean values. The `value_type` of the aligned result is
207    // `INT64`.
208    ALIGN_COUNT = 13;
209
210    // Align the time series by returning the sum of the values in each
211    // alignment period. This aligner is valid for `GAUGE` and `DELTA`
212    // metrics with numeric and distribution values. The `value_type` of the
213    // aligned result is the same as the `value_type` of the input.
214    ALIGN_SUM = 14;
215
216    // Align the time series by returning the standard deviation of the values
217    // in each alignment period. This aligner is valid for `GAUGE` and
218    // `DELTA` metrics with numeric values. The `value_type` of the output is
219    // `DOUBLE`.
220    ALIGN_STDDEV = 15;
221
222    // Align the time series by returning the number of `True` values in
223    // each alignment period. This aligner is valid for `GAUGE` metrics with
224    // Boolean values. The `value_type` of the output is `INT64`.
225    ALIGN_COUNT_TRUE = 16;
226
227    // Align the time series by returning the number of `False` values in
228    // each alignment period. This aligner is valid for `GAUGE` metrics with
229    // Boolean values. The `value_type` of the output is `INT64`.
230    ALIGN_COUNT_FALSE = 24;
231
232    // Align the time series by returning the ratio of the number of `True`
233    // values to the total number of values in each alignment period. This
234    // aligner is valid for `GAUGE` metrics with Boolean values. The output
235    // value is in the range [0.0, 1.0] and has `value_type` `DOUBLE`.
236    ALIGN_FRACTION_TRUE = 17;
237
238    // Align the time series by using [percentile
239    // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
240    // data point in each alignment period is the 99th percentile of all data
241    // points in the period. This aligner is valid for `GAUGE` and `DELTA`
242    // metrics with distribution values. The output is a `GAUGE` metric with
243    // `value_type` `DOUBLE`.
244    ALIGN_PERCENTILE_99 = 18;
245
246    // Align the time series by using [percentile
247    // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
248    // data point in each alignment period is the 95th percentile of all data
249    // points in the period. This aligner is valid for `GAUGE` and `DELTA`
250    // metrics with distribution values. The output is a `GAUGE` metric with
251    // `value_type` `DOUBLE`.
252    ALIGN_PERCENTILE_95 = 19;
253
254    // Align the time series by using [percentile
255    // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
256    // data point in each alignment period is the 50th percentile of all data
257    // points in the period. This aligner is valid for `GAUGE` and `DELTA`
258    // metrics with distribution values. The output is a `GAUGE` metric with
259    // `value_type` `DOUBLE`.
260    ALIGN_PERCENTILE_50 = 20;
261
262    // Align the time series by using [percentile
263    // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
264    // data point in each alignment period is the 5th percentile of all data
265    // points in the period. This aligner is valid for `GAUGE` and `DELTA`
266    // metrics with distribution values. The output is a `GAUGE` metric with
267    // `value_type` `DOUBLE`.
268    ALIGN_PERCENTILE_05 = 21;
269
270    // Align and convert to a percentage change. This aligner is valid for
271    // `GAUGE` and `DELTA` metrics with numeric values. This alignment returns
272    // `((current - previous)/previous) * 100`, where the value of `previous` is
273    // determined based on the `alignment_period`.
274    //
275    // If the values of `current` and `previous` are both 0, then the returned
276    // value is 0. If only `previous` is 0, the returned value is infinity.
277    //
278    // A 10-minute moving mean is computed at each point of the alignment period
279    // prior to the above calculation to smooth the metric and prevent false
280    // positives from very short-lived spikes. The moving mean is only
281    // applicable for data whose values are `>= 0`. Any values `< 0` are
282    // treated as a missing datapoint, and are ignored. While `DELTA`
283    // metrics are accepted by this alignment, special care should be taken that
284    // the values for the metric will always be positive. The output is a
285    // `GAUGE` metric with `value_type` `DOUBLE`.
286    ALIGN_PERCENT_CHANGE = 23;
287  }
288
289  // A Reducer operation describes how to aggregate data points from multiple
290  // time series into a single time series, where the value of each data point
291  // in the resulting series is a function of all the already aligned values in
292  // the input time series.
293  enum Reducer {
294    // No cross-time series reduction. The output of the `Aligner` is
295    // returned.
296    REDUCE_NONE = 0;
297
298    // Reduce by computing the mean value across time series for each
299    // alignment period. This reducer is valid for
300    // [DELTA][google.api.MetricDescriptor.MetricKind.DELTA] and
301    // [GAUGE][google.api.MetricDescriptor.MetricKind.GAUGE] metrics with
302    // numeric or distribution values. The `value_type` of the output is
303    // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE].
304    REDUCE_MEAN = 1;
305
306    // Reduce by computing the minimum value across time series for each
307    // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics
308    // with numeric values. The `value_type` of the output is the same as the
309    // `value_type` of the input.
310    REDUCE_MIN = 2;
311
312    // Reduce by computing the maximum value across time series for each
313    // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics
314    // with numeric values. The `value_type` of the output is the same as the
315    // `value_type` of the input.
316    REDUCE_MAX = 3;
317
318    // Reduce by computing the sum across time series for each
319    // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics
320    // with numeric and distribution values. The `value_type` of the output is
321    // the same as the `value_type` of the input.
322    REDUCE_SUM = 4;
323
324    // Reduce by computing the standard deviation across time series
325    // for each alignment period. This reducer is valid for `DELTA` and
326    // `GAUGE` metrics with numeric or distribution values. The `value_type`
327    // of the output is `DOUBLE`.
328    REDUCE_STDDEV = 5;
329
330    // Reduce by computing the number of data points across time series
331    // for each alignment period. This reducer is valid for `DELTA` and
332    // `GAUGE` metrics of numeric, Boolean, distribution, and string
333    // `value_type`. The `value_type` of the output is `INT64`.
334    REDUCE_COUNT = 6;
335
336    // Reduce by computing the number of `True`-valued data points across time
337    // series for each alignment period. This reducer is valid for `DELTA` and
338    // `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output
339    // is `INT64`.
340    REDUCE_COUNT_TRUE = 7;
341
342    // Reduce by computing the number of `False`-valued data points across time
343    // series for each alignment period. This reducer is valid for `DELTA` and
344    // `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output
345    // is `INT64`.
346    REDUCE_COUNT_FALSE = 15;
347
348    // Reduce by computing the ratio of the number of `True`-valued data points
349    // to the total number of data points for each alignment period. This
350    // reducer is valid for `DELTA` and `GAUGE` metrics of Boolean `value_type`.
351    // The output value is in the range [0.0, 1.0] and has `value_type`
352    // `DOUBLE`.
353    REDUCE_FRACTION_TRUE = 8;
354
355    // Reduce by computing the [99th
356    // percentile](https://en.wikipedia.org/wiki/Percentile) of data points
357    // across time series for each alignment period. This reducer is valid for
358    // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
359    // of the output is `DOUBLE`.
360    REDUCE_PERCENTILE_99 = 9;
361
362    // Reduce by computing the [95th
363    // percentile](https://en.wikipedia.org/wiki/Percentile) of data points
364    // across time series for each alignment period. This reducer is valid for
365    // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
366    // of the output is `DOUBLE`.
367    REDUCE_PERCENTILE_95 = 10;
368
369    // Reduce by computing the [50th
370    // percentile](https://en.wikipedia.org/wiki/Percentile) of data points
371    // across time series for each alignment period. This reducer is valid for
372    // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
373    // of the output is `DOUBLE`.
374    REDUCE_PERCENTILE_50 = 11;
375
376    // Reduce by computing the [5th
377    // percentile](https://en.wikipedia.org/wiki/Percentile) of data points
378    // across time series for each alignment period. This reducer is valid for
379    // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
380    // of the output is `DOUBLE`.
381    REDUCE_PERCENTILE_05 = 12;
382  }
383
384  // The `alignment_period` specifies a time interval, in seconds, that is used
385  // to divide the data in all the
386  // [time series][google.monitoring.v3.TimeSeries] into consistent blocks of
387  // time. This will be done before the per-series aligner can be applied to
388  // the data.
389  //
390  // The value must be at least 60 seconds. If a per-series
391  // aligner other than `ALIGN_NONE` is specified, this field is required or an
392  // error is returned. If no per-series aligner is specified, or the aligner
393  // `ALIGN_NONE` is specified, then this field is ignored.
394  //
395  // The maximum value of the `alignment_period` is 104 weeks (2 years) for
396  // charts, and 90,000 seconds (25 hours) for alerting policies.
397  google.protobuf.Duration alignment_period = 1;
398
399  // An `Aligner` describes how to bring the data points in a single
400  // time series into temporal alignment. Except for `ALIGN_NONE`, all
401  // alignments cause all the data points in an `alignment_period` to be
402  // mathematically grouped together, resulting in a single data point for
403  // each `alignment_period` with end timestamp at the end of the period.
404  //
405  // Not all alignment operations may be applied to all time series. The valid
406  // choices depend on the `metric_kind` and `value_type` of the original time
407  // series. Alignment can change the `metric_kind` or the `value_type` of
408  // the time series.
409  //
410  // Time series data must be aligned in order to perform cross-time
411  // series reduction. If `cross_series_reducer` is specified, then
412  // `per_series_aligner` must be specified and not equal to `ALIGN_NONE`
413  // and `alignment_period` must be specified; otherwise, an error is
414  // returned.
415  Aligner per_series_aligner = 2;
416
417  // The reduction operation to be used to combine time series into a single
418  // time series, where the value of each data point in the resulting series is
419  // a function of all the already aligned values in the input time series.
420  //
421  // Not all reducer operations can be applied to all time series. The valid
422  // choices depend on the `metric_kind` and the `value_type` of the original
423  // time series. Reduction can yield a time series with a different
424  // `metric_kind` or `value_type` than the input time series.
425  //
426  // Time series data must first be aligned (see `per_series_aligner`) in order
427  // to perform cross-time series reduction. If `cross_series_reducer` is
428  // specified, then `per_series_aligner` must be specified, and must not be
429  // `ALIGN_NONE`. An `alignment_period` must also be specified; otherwise, an
430  // error is returned.
431  Reducer cross_series_reducer = 4;
432
433  // The set of fields to preserve when `cross_series_reducer` is
434  // specified. The `group_by_fields` determine how the time series are
435  // partitioned into subsets prior to applying the aggregation
436  // operation. Each subset contains time series that have the same
437  // value for each of the grouping fields. Each individual time
438  // series is a member of exactly one subset. The
439  // `cross_series_reducer` is applied to each subset of time series.
440  // It is not possible to reduce across different resource types, so
441  // this field implicitly contains `resource.type`.  Fields not
442  // specified in `group_by_fields` are aggregated away.  If
443  // `group_by_fields` is not specified and all the time series have
444  // the same resource type, then the time series are aggregated into
445  // a single output time series. If `cross_series_reducer` is not
446  // defined, this field is ignored.
447  repeated string group_by_fields = 5;
448}
449
450// Specifies an ordering relationship on two arguments, called `left` and
451// `right`.
452enum ComparisonType {
453  // No ordering relationship is specified.
454  COMPARISON_UNSPECIFIED = 0;
455
456  // True if the left argument is greater than the right argument.
457  COMPARISON_GT = 1;
458
459  // True if the left argument is greater than or equal to the right argument.
460  COMPARISON_GE = 2;
461
462  // True if the left argument is less than the right argument.
463  COMPARISON_LT = 3;
464
465  // True if the left argument is less than or equal to the right argument.
466  COMPARISON_LE = 4;
467
468  // True if the left argument is equal to the right argument.
469  COMPARISON_EQ = 5;
470
471  // True if the left argument is not equal to the right argument.
472  COMPARISON_NE = 6;
473}
474
475// The tier of service for a Metrics Scope. Please see the
476// [service tiers
477// documentation](https://cloud.google.com/monitoring/workspaces/tiers) for more
478// details.
479enum ServiceTier {
480  option deprecated = true;
481
482  // An invalid sentinel value, used to indicate that a tier has not
483  // been provided explicitly.
484  SERVICE_TIER_UNSPECIFIED = 0;
485
486  // The Cloud Monitoring Basic tier, a free tier of service that provides basic
487  // features, a moderate allotment of logs, and access to built-in metrics.
488  // A number of features are not available in this tier. For more details,
489  // see [the service tiers
490  // documentation](https://cloud.google.com/monitoring/workspaces/tiers).
491  SERVICE_TIER_BASIC = 1;
492
493  // The Cloud Monitoring Premium tier, a higher, more expensive tier of service
494  // that provides access to all Cloud Monitoring features, lets you use Cloud
495  // Monitoring with AWS accounts, and has a larger allotments for logs and
496  // metrics. For more details, see [the service tiers
497  // documentation](https://cloud.google.com/monitoring/workspaces/tiers).
498  SERVICE_TIER_PREMIUM = 2;
499}
500