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