xref: /aosp_15_r20/external/googleapis/google/monitoring/v3/alert.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1*d5c09012SAndroid Build Coastguard Worker// Copyright 2023 Google LLC
2*d5c09012SAndroid Build Coastguard Worker//
3*d5c09012SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*d5c09012SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*d5c09012SAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*d5c09012SAndroid Build Coastguard Worker//
7*d5c09012SAndroid Build Coastguard Worker//     http://www.apache.org/licenses/LICENSE-2.0
8*d5c09012SAndroid Build Coastguard Worker//
9*d5c09012SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*d5c09012SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*d5c09012SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*d5c09012SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*d5c09012SAndroid Build Coastguard Worker// limitations under the License.
14*d5c09012SAndroid Build Coastguard Worker
15*d5c09012SAndroid Build Coastguard Workersyntax = "proto3";
16*d5c09012SAndroid Build Coastguard Worker
17*d5c09012SAndroid Build Coastguard Workerpackage google.monitoring.v3;
18*d5c09012SAndroid Build Coastguard Worker
19*d5c09012SAndroid Build Coastguard Workerimport "google/api/field_behavior.proto";
20*d5c09012SAndroid Build Coastguard Workerimport "google/api/resource.proto";
21*d5c09012SAndroid Build Coastguard Workerimport "google/monitoring/v3/common.proto";
22*d5c09012SAndroid Build Coastguard Workerimport "google/monitoring/v3/mutation_record.proto";
23*d5c09012SAndroid Build Coastguard Workerimport "google/protobuf/duration.proto";
24*d5c09012SAndroid Build Coastguard Workerimport "google/protobuf/wrappers.proto";
25*d5c09012SAndroid Build Coastguard Workerimport "google/rpc/status.proto";
26*d5c09012SAndroid Build Coastguard Worker
27*d5c09012SAndroid Build Coastguard Workeroption csharp_namespace = "Google.Cloud.Monitoring.V3";
28*d5c09012SAndroid Build Coastguard Workeroption go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
29*d5c09012SAndroid Build Coastguard Workeroption java_multiple_files = true;
30*d5c09012SAndroid Build Coastguard Workeroption java_outer_classname = "AlertProto";
31*d5c09012SAndroid Build Coastguard Workeroption java_package = "com.google.monitoring.v3";
32*d5c09012SAndroid Build Coastguard Workeroption php_namespace = "Google\\Cloud\\Monitoring\\V3";
33*d5c09012SAndroid Build Coastguard Workeroption ruby_package = "Google::Cloud::Monitoring::V3";
34*d5c09012SAndroid Build Coastguard Worker
35*d5c09012SAndroid Build Coastguard Worker// A description of the conditions under which some aspect of your system is
36*d5c09012SAndroid Build Coastguard Worker// considered to be "unhealthy" and the ways to notify people or services about
37*d5c09012SAndroid Build Coastguard Worker// this state. For an overview of alert policies, see
38*d5c09012SAndroid Build Coastguard Worker// [Introduction to Alerting](https://cloud.google.com/monitoring/alerts/).
39*d5c09012SAndroid Build Coastguard Worker//
40*d5c09012SAndroid Build Coastguard Workermessage AlertPolicy {
41*d5c09012SAndroid Build Coastguard Worker  option (google.api.resource) = {
42*d5c09012SAndroid Build Coastguard Worker    type: "monitoring.googleapis.com/AlertPolicy"
43*d5c09012SAndroid Build Coastguard Worker    pattern: "projects/{project}/alertPolicies/{alert_policy}"
44*d5c09012SAndroid Build Coastguard Worker    pattern: "organizations/{organization}/alertPolicies/{alert_policy}"
45*d5c09012SAndroid Build Coastguard Worker    pattern: "folders/{folder}/alertPolicies/{alert_policy}"
46*d5c09012SAndroid Build Coastguard Worker    pattern: "*"
47*d5c09012SAndroid Build Coastguard Worker  };
48*d5c09012SAndroid Build Coastguard Worker
49*d5c09012SAndroid Build Coastguard Worker  // Documentation that is included in the notifications and incidents
50*d5c09012SAndroid Build Coastguard Worker  // pertaining to this policy.
51*d5c09012SAndroid Build Coastguard Worker  message Documentation {
52*d5c09012SAndroid Build Coastguard Worker    // The body of the documentation, interpreted according to `mime_type`.
53*d5c09012SAndroid Build Coastguard Worker    // The content may not exceed 8,192 Unicode characters and may not exceed
54*d5c09012SAndroid Build Coastguard Worker    // more than 10,240 bytes when encoded in UTF-8 format, whichever is
55*d5c09012SAndroid Build Coastguard Worker    // smaller. This text can be [templatized by using
56*d5c09012SAndroid Build Coastguard Worker    // variables](https://cloud.google.com/monitoring/alerts/doc-variables).
57*d5c09012SAndroid Build Coastguard Worker    string content = 1;
58*d5c09012SAndroid Build Coastguard Worker
59*d5c09012SAndroid Build Coastguard Worker    // The format of the `content` field. Presently, only the value
60*d5c09012SAndroid Build Coastguard Worker    // `"text/markdown"` is supported. See
61*d5c09012SAndroid Build Coastguard Worker    // [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
62*d5c09012SAndroid Build Coastguard Worker    string mime_type = 2;
63*d5c09012SAndroid Build Coastguard Worker
64*d5c09012SAndroid Build Coastguard Worker    // Optional. The subject line of the notification. The subject line may not
65*d5c09012SAndroid Build Coastguard Worker    // exceed 10,240 bytes. In notifications generated by this policy, the
66*d5c09012SAndroid Build Coastguard Worker    // contents of the subject line after variable expansion will be truncated
67*d5c09012SAndroid Build Coastguard Worker    // to 255 bytes or shorter at the latest UTF-8 character boundary. The
68*d5c09012SAndroid Build Coastguard Worker    // 255-byte limit is recommended by [this
69*d5c09012SAndroid Build Coastguard Worker    // thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit).
70*d5c09012SAndroid Build Coastguard Worker    // It is both the limit imposed by some third-party ticketing products and
71*d5c09012SAndroid Build Coastguard Worker    // it is common to define textual fields in databases as VARCHAR(255).
72*d5c09012SAndroid Build Coastguard Worker    //
73*d5c09012SAndroid Build Coastguard Worker    // The contents of the subject line can be [templatized by using
74*d5c09012SAndroid Build Coastguard Worker    // variables](https://cloud.google.com/monitoring/alerts/doc-variables).
75*d5c09012SAndroid Build Coastguard Worker    // If this field is missing or empty, a default subject line will be
76*d5c09012SAndroid Build Coastguard Worker    // generated.
77*d5c09012SAndroid Build Coastguard Worker    string subject = 3 [(google.api.field_behavior) = OPTIONAL];
78*d5c09012SAndroid Build Coastguard Worker  }
79*d5c09012SAndroid Build Coastguard Worker
80*d5c09012SAndroid Build Coastguard Worker  // A condition is a true/false test that determines when an alerting policy
81*d5c09012SAndroid Build Coastguard Worker  // should open an incident. If a condition evaluates to true, it signifies
82*d5c09012SAndroid Build Coastguard Worker  // that something is wrong.
83*d5c09012SAndroid Build Coastguard Worker  message Condition {
84*d5c09012SAndroid Build Coastguard Worker    option (google.api.resource) = {
85*d5c09012SAndroid Build Coastguard Worker      type: "monitoring.googleapis.com/AlertPolicyCondition"
86*d5c09012SAndroid Build Coastguard Worker      pattern: "projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}"
87*d5c09012SAndroid Build Coastguard Worker      pattern: "organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}"
88*d5c09012SAndroid Build Coastguard Worker      pattern: "folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}"
89*d5c09012SAndroid Build Coastguard Worker      pattern: "*"
90*d5c09012SAndroid Build Coastguard Worker    };
91*d5c09012SAndroid Build Coastguard Worker
92*d5c09012SAndroid Build Coastguard Worker    // Specifies how many time series must fail a predicate to trigger a
93*d5c09012SAndroid Build Coastguard Worker    // condition. If not specified, then a `{count: 1}` trigger is used.
94*d5c09012SAndroid Build Coastguard Worker    message Trigger {
95*d5c09012SAndroid Build Coastguard Worker      // A type of trigger.
96*d5c09012SAndroid Build Coastguard Worker      oneof type {
97*d5c09012SAndroid Build Coastguard Worker        // The absolute number of time series that must fail
98*d5c09012SAndroid Build Coastguard Worker        // the predicate for the condition to be triggered.
99*d5c09012SAndroid Build Coastguard Worker        int32 count = 1;
100*d5c09012SAndroid Build Coastguard Worker
101*d5c09012SAndroid Build Coastguard Worker        // The percentage of time series that must fail the
102*d5c09012SAndroid Build Coastguard Worker        // predicate for the condition to be triggered.
103*d5c09012SAndroid Build Coastguard Worker        double percent = 2;
104*d5c09012SAndroid Build Coastguard Worker      }
105*d5c09012SAndroid Build Coastguard Worker    }
106*d5c09012SAndroid Build Coastguard Worker
107*d5c09012SAndroid Build Coastguard Worker    // A condition control that determines how metric-threshold conditions
108*d5c09012SAndroid Build Coastguard Worker    // are evaluated when data stops arriving.
109*d5c09012SAndroid Build Coastguard Worker    // This control doesn't affect metric-absence policies.
110*d5c09012SAndroid Build Coastguard Worker    enum EvaluationMissingData {
111*d5c09012SAndroid Build Coastguard Worker      // An unspecified evaluation missing data option.  Equivalent to
112*d5c09012SAndroid Build Coastguard Worker      // EVALUATION_MISSING_DATA_NO_OP.
113*d5c09012SAndroid Build Coastguard Worker      EVALUATION_MISSING_DATA_UNSPECIFIED = 0;
114*d5c09012SAndroid Build Coastguard Worker
115*d5c09012SAndroid Build Coastguard Worker      // If there is no data to evaluate the condition, then evaluate the
116*d5c09012SAndroid Build Coastguard Worker      // condition as false.
117*d5c09012SAndroid Build Coastguard Worker      EVALUATION_MISSING_DATA_INACTIVE = 1;
118*d5c09012SAndroid Build Coastguard Worker
119*d5c09012SAndroid Build Coastguard Worker      // If there is no data to evaluate the condition, then evaluate the
120*d5c09012SAndroid Build Coastguard Worker      // condition as true.
121*d5c09012SAndroid Build Coastguard Worker      EVALUATION_MISSING_DATA_ACTIVE = 2;
122*d5c09012SAndroid Build Coastguard Worker
123*d5c09012SAndroid Build Coastguard Worker      // Do not evaluate the condition to any value if there is no data.
124*d5c09012SAndroid Build Coastguard Worker      EVALUATION_MISSING_DATA_NO_OP = 3;
125*d5c09012SAndroid Build Coastguard Worker    }
126*d5c09012SAndroid Build Coastguard Worker
127*d5c09012SAndroid Build Coastguard Worker    // A condition type that compares a collection of time series
128*d5c09012SAndroid Build Coastguard Worker    // against a threshold.
129*d5c09012SAndroid Build Coastguard Worker    message MetricThreshold {
130*d5c09012SAndroid Build Coastguard Worker      // Options used when forecasting the time series and testing
131*d5c09012SAndroid Build Coastguard Worker      // the predicted value against the threshold.
132*d5c09012SAndroid Build Coastguard Worker      message ForecastOptions {
133*d5c09012SAndroid Build Coastguard Worker        // Required. The length of time into the future to forecast whether a
134*d5c09012SAndroid Build Coastguard Worker        // time series will violate the threshold. If the predicted value is
135*d5c09012SAndroid Build Coastguard Worker        // found to violate the threshold, and the violation is observed in all
136*d5c09012SAndroid Build Coastguard Worker        // forecasts made for the configured `duration`, then the time series is
137*d5c09012SAndroid Build Coastguard Worker        // considered to be failing.
138*d5c09012SAndroid Build Coastguard Worker        // The forecast horizon can range from 1 hour to 60 hours.
139*d5c09012SAndroid Build Coastguard Worker        google.protobuf.Duration forecast_horizon = 1
140*d5c09012SAndroid Build Coastguard Worker            [(google.api.field_behavior) = REQUIRED];
141*d5c09012SAndroid Build Coastguard Worker      }
142*d5c09012SAndroid Build Coastguard Worker
143*d5c09012SAndroid Build Coastguard Worker      // Required. A
144*d5c09012SAndroid Build Coastguard Worker      // [filter](https://cloud.google.com/monitoring/api/v3/filters) that
145*d5c09012SAndroid Build Coastguard Worker      // identifies which time series should be compared with the threshold.
146*d5c09012SAndroid Build Coastguard Worker      //
147*d5c09012SAndroid Build Coastguard Worker      // The filter is similar to the one that is specified in the
148*d5c09012SAndroid Build Coastguard Worker      // [`ListTimeSeries`
149*d5c09012SAndroid Build Coastguard Worker      // request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
150*d5c09012SAndroid Build Coastguard Worker      // (that call is useful to verify the time series that will be retrieved /
151*d5c09012SAndroid Build Coastguard Worker      // processed). The filter must specify the metric type and the resource
152*d5c09012SAndroid Build Coastguard Worker      // type. Optionally, it can specify resource labels and metric labels.
153*d5c09012SAndroid Build Coastguard Worker      // This field must not exceed 2048 Unicode characters in length.
154*d5c09012SAndroid Build Coastguard Worker      string filter = 2 [(google.api.field_behavior) = REQUIRED];
155*d5c09012SAndroid Build Coastguard Worker
156*d5c09012SAndroid Build Coastguard Worker      // Specifies the alignment of data points in individual time series as
157*d5c09012SAndroid Build Coastguard Worker      // well as how to combine the retrieved time series together (such as
158*d5c09012SAndroid Build Coastguard Worker      // when aggregating multiple streams on each resource to a single
159*d5c09012SAndroid Build Coastguard Worker      // stream for each resource or when aggregating streams across all
160*d5c09012SAndroid Build Coastguard Worker      // members of a group of resources). Multiple aggregations
161*d5c09012SAndroid Build Coastguard Worker      // are applied in the order specified.
162*d5c09012SAndroid Build Coastguard Worker      //
163*d5c09012SAndroid Build Coastguard Worker      // This field is similar to the one in the [`ListTimeSeries`
164*d5c09012SAndroid Build Coastguard Worker      // request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
165*d5c09012SAndroid Build Coastguard Worker      // It is advisable to use the `ListTimeSeries` method when debugging this
166*d5c09012SAndroid Build Coastguard Worker      // field.
167*d5c09012SAndroid Build Coastguard Worker      repeated Aggregation aggregations = 8;
168*d5c09012SAndroid Build Coastguard Worker
169*d5c09012SAndroid Build Coastguard Worker      // A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
170*d5c09012SAndroid Build Coastguard Worker      // identifies a time series that should be used as the denominator of a
171*d5c09012SAndroid Build Coastguard Worker      // ratio that will be compared with the threshold. If a
172*d5c09012SAndroid Build Coastguard Worker      // `denominator_filter` is specified, the time series specified by the
173*d5c09012SAndroid Build Coastguard Worker      // `filter` field will be used as the numerator.
174*d5c09012SAndroid Build Coastguard Worker      //
175*d5c09012SAndroid Build Coastguard Worker      // The filter must specify the metric type and optionally may contain
176*d5c09012SAndroid Build Coastguard Worker      // restrictions on resource type, resource labels, and metric labels.
177*d5c09012SAndroid Build Coastguard Worker      // This field may not exceed 2048 Unicode characters in length.
178*d5c09012SAndroid Build Coastguard Worker      string denominator_filter = 9;
179*d5c09012SAndroid Build Coastguard Worker
180*d5c09012SAndroid Build Coastguard Worker      // Specifies the alignment of data points in individual time series
181*d5c09012SAndroid Build Coastguard Worker      // selected by `denominatorFilter` as
182*d5c09012SAndroid Build Coastguard Worker      // well as how to combine the retrieved time series together (such as
183*d5c09012SAndroid Build Coastguard Worker      // when aggregating multiple streams on each resource to a single
184*d5c09012SAndroid Build Coastguard Worker      // stream for each resource or when aggregating streams across all
185*d5c09012SAndroid Build Coastguard Worker      // members of a group of resources).
186*d5c09012SAndroid Build Coastguard Worker      //
187*d5c09012SAndroid Build Coastguard Worker      // When computing ratios, the `aggregations` and
188*d5c09012SAndroid Build Coastguard Worker      // `denominator_aggregations` fields must use the same alignment period
189*d5c09012SAndroid Build Coastguard Worker      // and produce time series that have the same periodicity and labels.
190*d5c09012SAndroid Build Coastguard Worker      repeated Aggregation denominator_aggregations = 10;
191*d5c09012SAndroid Build Coastguard Worker
192*d5c09012SAndroid Build Coastguard Worker      // When this field is present, the `MetricThreshold` condition forecasts
193*d5c09012SAndroid Build Coastguard Worker      // whether the time series is predicted to violate the threshold within
194*d5c09012SAndroid Build Coastguard Worker      // the `forecast_horizon`. When this field is not set, the
195*d5c09012SAndroid Build Coastguard Worker      // `MetricThreshold` tests the current value of the timeseries against the
196*d5c09012SAndroid Build Coastguard Worker      // threshold.
197*d5c09012SAndroid Build Coastguard Worker      ForecastOptions forecast_options = 12;
198*d5c09012SAndroid Build Coastguard Worker
199*d5c09012SAndroid Build Coastguard Worker      // The comparison to apply between the time series (indicated by `filter`
200*d5c09012SAndroid Build Coastguard Worker      // and `aggregation`) and the threshold (indicated by `threshold_value`).
201*d5c09012SAndroid Build Coastguard Worker      // The comparison is applied on each time series, with the time series
202*d5c09012SAndroid Build Coastguard Worker      // on the left-hand side and the threshold on the right-hand side.
203*d5c09012SAndroid Build Coastguard Worker      //
204*d5c09012SAndroid Build Coastguard Worker      // Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
205*d5c09012SAndroid Build Coastguard Worker      ComparisonType comparison = 4;
206*d5c09012SAndroid Build Coastguard Worker
207*d5c09012SAndroid Build Coastguard Worker      // A value against which to compare the time series.
208*d5c09012SAndroid Build Coastguard Worker      double threshold_value = 5;
209*d5c09012SAndroid Build Coastguard Worker
210*d5c09012SAndroid Build Coastguard Worker      // The amount of time that a time series must violate the
211*d5c09012SAndroid Build Coastguard Worker      // threshold to be considered failing. Currently, only values
212*d5c09012SAndroid Build Coastguard Worker      // that are a multiple of a minute--e.g., 0, 60, 120, or 300
213*d5c09012SAndroid Build Coastguard Worker      // seconds--are supported. If an invalid value is given, an
214*d5c09012SAndroid Build Coastguard Worker      // error will be returned. When choosing a duration, it is useful to
215*d5c09012SAndroid Build Coastguard Worker      // keep in mind the frequency of the underlying time series data
216*d5c09012SAndroid Build Coastguard Worker      // (which may also be affected by any alignments specified in the
217*d5c09012SAndroid Build Coastguard Worker      // `aggregations` field); a good duration is long enough so that a single
218*d5c09012SAndroid Build Coastguard Worker      // outlier does not generate spurious alerts, but short enough that
219*d5c09012SAndroid Build Coastguard Worker      // unhealthy states are detected and alerted on quickly.
220*d5c09012SAndroid Build Coastguard Worker      google.protobuf.Duration duration = 6;
221*d5c09012SAndroid Build Coastguard Worker
222*d5c09012SAndroid Build Coastguard Worker      // The number/percent of time series for which the comparison must hold
223*d5c09012SAndroid Build Coastguard Worker      // in order for the condition to trigger. If unspecified, then the
224*d5c09012SAndroid Build Coastguard Worker      // condition will trigger if the comparison is true for any of the
225*d5c09012SAndroid Build Coastguard Worker      // time series that have been identified by `filter` and `aggregations`,
226*d5c09012SAndroid Build Coastguard Worker      // or by the ratio, if `denominator_filter` and `denominator_aggregations`
227*d5c09012SAndroid Build Coastguard Worker      // are specified.
228*d5c09012SAndroid Build Coastguard Worker      Trigger trigger = 7;
229*d5c09012SAndroid Build Coastguard Worker
230*d5c09012SAndroid Build Coastguard Worker      // A condition control that determines how metric-threshold conditions
231*d5c09012SAndroid Build Coastguard Worker      // are evaluated when data stops arriving. To use this control, the value
232*d5c09012SAndroid Build Coastguard Worker      // of the `duration` field must be greater than or equal to 60 seconds.
233*d5c09012SAndroid Build Coastguard Worker      EvaluationMissingData evaluation_missing_data = 11;
234*d5c09012SAndroid Build Coastguard Worker    }
235*d5c09012SAndroid Build Coastguard Worker
236*d5c09012SAndroid Build Coastguard Worker    // A condition type that checks that monitored resources
237*d5c09012SAndroid Build Coastguard Worker    // are reporting data. The configuration defines a metric and
238*d5c09012SAndroid Build Coastguard Worker    // a set of monitored resources. The predicate is considered in violation
239*d5c09012SAndroid Build Coastguard Worker    // when a time series for the specified metric of a monitored
240*d5c09012SAndroid Build Coastguard Worker    // resource does not include any data in the specified `duration`.
241*d5c09012SAndroid Build Coastguard Worker    message MetricAbsence {
242*d5c09012SAndroid Build Coastguard Worker      // Required. A
243*d5c09012SAndroid Build Coastguard Worker      // [filter](https://cloud.google.com/monitoring/api/v3/filters) that
244*d5c09012SAndroid Build Coastguard Worker      // identifies which time series should be compared with the threshold.
245*d5c09012SAndroid Build Coastguard Worker      //
246*d5c09012SAndroid Build Coastguard Worker      // The filter is similar to the one that is specified in the
247*d5c09012SAndroid Build Coastguard Worker      // [`ListTimeSeries`
248*d5c09012SAndroid Build Coastguard Worker      // request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
249*d5c09012SAndroid Build Coastguard Worker      // (that call is useful to verify the time series that will be retrieved /
250*d5c09012SAndroid Build Coastguard Worker      // processed). The filter must specify the metric type and the resource
251*d5c09012SAndroid Build Coastguard Worker      // type. Optionally, it can specify resource labels and metric labels.
252*d5c09012SAndroid Build Coastguard Worker      // This field must not exceed 2048 Unicode characters in length.
253*d5c09012SAndroid Build Coastguard Worker      string filter = 1 [(google.api.field_behavior) = REQUIRED];
254*d5c09012SAndroid Build Coastguard Worker
255*d5c09012SAndroid Build Coastguard Worker      // Specifies the alignment of data points in individual time series as
256*d5c09012SAndroid Build Coastguard Worker      // well as how to combine the retrieved time series together (such as
257*d5c09012SAndroid Build Coastguard Worker      // when aggregating multiple streams on each resource to a single
258*d5c09012SAndroid Build Coastguard Worker      // stream for each resource or when aggregating streams across all
259*d5c09012SAndroid Build Coastguard Worker      // members of a group of resources). Multiple aggregations
260*d5c09012SAndroid Build Coastguard Worker      // are applied in the order specified.
261*d5c09012SAndroid Build Coastguard Worker      //
262*d5c09012SAndroid Build Coastguard Worker      // This field is similar to the one in the [`ListTimeSeries`
263*d5c09012SAndroid Build Coastguard Worker      // request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
264*d5c09012SAndroid Build Coastguard Worker      // It is advisable to use the `ListTimeSeries` method when debugging this
265*d5c09012SAndroid Build Coastguard Worker      // field.
266*d5c09012SAndroid Build Coastguard Worker      repeated Aggregation aggregations = 5;
267*d5c09012SAndroid Build Coastguard Worker
268*d5c09012SAndroid Build Coastguard Worker      // The amount of time that a time series must fail to report new
269*d5c09012SAndroid Build Coastguard Worker      // data to be considered failing. The minimum value of this field
270*d5c09012SAndroid Build Coastguard Worker      // is 120 seconds. Larger values that are a multiple of a
271*d5c09012SAndroid Build Coastguard Worker      // minute--for example, 240 or 300 seconds--are supported.
272*d5c09012SAndroid Build Coastguard Worker      // If an invalid value is given, an
273*d5c09012SAndroid Build Coastguard Worker      // error will be returned. The `Duration.nanos` field is
274*d5c09012SAndroid Build Coastguard Worker      // ignored.
275*d5c09012SAndroid Build Coastguard Worker      google.protobuf.Duration duration = 2;
276*d5c09012SAndroid Build Coastguard Worker
277*d5c09012SAndroid Build Coastguard Worker      // The number/percent of time series for which the comparison must hold
278*d5c09012SAndroid Build Coastguard Worker      // in order for the condition to trigger. If unspecified, then the
279*d5c09012SAndroid Build Coastguard Worker      // condition will trigger if the comparison is true for any of the
280*d5c09012SAndroid Build Coastguard Worker      // time series that have been identified by `filter` and `aggregations`.
281*d5c09012SAndroid Build Coastguard Worker      Trigger trigger = 3;
282*d5c09012SAndroid Build Coastguard Worker    }
283*d5c09012SAndroid Build Coastguard Worker
284*d5c09012SAndroid Build Coastguard Worker    // A condition type that checks whether a log message in the [scoping
285*d5c09012SAndroid Build Coastguard Worker    // project](https://cloud.google.com/monitoring/api/v3#project_name)
286*d5c09012SAndroid Build Coastguard Worker    // satisfies the given filter. Logs from other projects in the metrics
287*d5c09012SAndroid Build Coastguard Worker    // scope are not evaluated.
288*d5c09012SAndroid Build Coastguard Worker    message LogMatch {
289*d5c09012SAndroid Build Coastguard Worker      // Required. A logs-based filter. See [Advanced Logs
290*d5c09012SAndroid Build Coastguard Worker      // Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
291*d5c09012SAndroid Build Coastguard Worker      // for how this filter should be constructed.
292*d5c09012SAndroid Build Coastguard Worker      string filter = 1 [(google.api.field_behavior) = REQUIRED];
293*d5c09012SAndroid Build Coastguard Worker
294*d5c09012SAndroid Build Coastguard Worker      // Optional. A map from a label key to an extractor expression, which is
295*d5c09012SAndroid Build Coastguard Worker      // used to extract the value for this label key. Each entry in this map is
296*d5c09012SAndroid Build Coastguard Worker      // a specification for how data should be extracted from log entries that
297*d5c09012SAndroid Build Coastguard Worker      // match `filter`. Each combination of extracted values is treated as a
298*d5c09012SAndroid Build Coastguard Worker      // separate rule for the purposes of triggering notifications. Label keys
299*d5c09012SAndroid Build Coastguard Worker      // and corresponding values can be used in notifications generated by this
300*d5c09012SAndroid Build Coastguard Worker      // condition.
301*d5c09012SAndroid Build Coastguard Worker      //
302*d5c09012SAndroid Build Coastguard Worker      // Please see [the documentation on logs-based metric
303*d5c09012SAndroid Build Coastguard Worker      // `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
304*d5c09012SAndroid Build Coastguard Worker      // for syntax and examples.
305*d5c09012SAndroid Build Coastguard Worker      map<string, string> label_extractors = 2;
306*d5c09012SAndroid Build Coastguard Worker    }
307*d5c09012SAndroid Build Coastguard Worker
308*d5c09012SAndroid Build Coastguard Worker    // A condition type that allows alert policies to be defined using
309*d5c09012SAndroid Build Coastguard Worker    // [Monitoring Query Language](https://cloud.google.com/monitoring/mql).
310*d5c09012SAndroid Build Coastguard Worker    message MonitoringQueryLanguageCondition {
311*d5c09012SAndroid Build Coastguard Worker      // [Monitoring Query Language](https://cloud.google.com/monitoring/mql)
312*d5c09012SAndroid Build Coastguard Worker      // query that outputs a boolean stream.
313*d5c09012SAndroid Build Coastguard Worker      string query = 1;
314*d5c09012SAndroid Build Coastguard Worker
315*d5c09012SAndroid Build Coastguard Worker      // The amount of time that a time series must violate the
316*d5c09012SAndroid Build Coastguard Worker      // threshold to be considered failing. Currently, only values
317*d5c09012SAndroid Build Coastguard Worker      // that are a multiple of a minute--e.g., 0, 60, 120, or 300
318*d5c09012SAndroid Build Coastguard Worker      // seconds--are supported. If an invalid value is given, an
319*d5c09012SAndroid Build Coastguard Worker      // error will be returned. When choosing a duration, it is useful to
320*d5c09012SAndroid Build Coastguard Worker      // keep in mind the frequency of the underlying time series data
321*d5c09012SAndroid Build Coastguard Worker      // (which may also be affected by any alignments specified in the
322*d5c09012SAndroid Build Coastguard Worker      // `aggregations` field); a good duration is long enough so that a single
323*d5c09012SAndroid Build Coastguard Worker      // outlier does not generate spurious alerts, but short enough that
324*d5c09012SAndroid Build Coastguard Worker      // unhealthy states are detected and alerted on quickly.
325*d5c09012SAndroid Build Coastguard Worker      google.protobuf.Duration duration = 2;
326*d5c09012SAndroid Build Coastguard Worker
327*d5c09012SAndroid Build Coastguard Worker      // The number/percent of time series for which the comparison must hold
328*d5c09012SAndroid Build Coastguard Worker      // in order for the condition to trigger. If unspecified, then the
329*d5c09012SAndroid Build Coastguard Worker      // condition will trigger if the comparison is true for any of the
330*d5c09012SAndroid Build Coastguard Worker      // time series that have been identified by `filter` and `aggregations`,
331*d5c09012SAndroid Build Coastguard Worker      // or by the ratio, if `denominator_filter` and `denominator_aggregations`
332*d5c09012SAndroid Build Coastguard Worker      // are specified.
333*d5c09012SAndroid Build Coastguard Worker      Trigger trigger = 3;
334*d5c09012SAndroid Build Coastguard Worker
335*d5c09012SAndroid Build Coastguard Worker      // A condition control that determines how metric-threshold conditions
336*d5c09012SAndroid Build Coastguard Worker      // are evaluated when data stops arriving.
337*d5c09012SAndroid Build Coastguard Worker      EvaluationMissingData evaluation_missing_data = 4;
338*d5c09012SAndroid Build Coastguard Worker    }
339*d5c09012SAndroid Build Coastguard Worker
340*d5c09012SAndroid Build Coastguard Worker    // A condition type that allows alert policies to be defined using
341*d5c09012SAndroid Build Coastguard Worker    // [Prometheus Query Language
342*d5c09012SAndroid Build Coastguard Worker    // (PromQL)](https://prometheus.io/docs/prometheus/latest/querying/basics/).
343*d5c09012SAndroid Build Coastguard Worker    //
344*d5c09012SAndroid Build Coastguard Worker    // The PrometheusQueryLanguageCondition message contains information
345*d5c09012SAndroid Build Coastguard Worker    // from a Prometheus alerting rule and its associated rule group.
346*d5c09012SAndroid Build Coastguard Worker    //
347*d5c09012SAndroid Build Coastguard Worker    // A Prometheus alerting rule is described
348*d5c09012SAndroid Build Coastguard Worker    // [here](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/).
349*d5c09012SAndroid Build Coastguard Worker    // The semantics of a Prometheus alerting rule is described
350*d5c09012SAndroid Build Coastguard Worker    // [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule).
351*d5c09012SAndroid Build Coastguard Worker    //
352*d5c09012SAndroid Build Coastguard Worker    // A Prometheus rule group is described
353*d5c09012SAndroid Build Coastguard Worker    // [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
354*d5c09012SAndroid Build Coastguard Worker    // The semantics of a Prometheus rule group is described
355*d5c09012SAndroid Build Coastguard Worker    // [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group).
356*d5c09012SAndroid Build Coastguard Worker    //
357*d5c09012SAndroid Build Coastguard Worker    // Because Cloud Alerting has no representation of a Prometheus rule
358*d5c09012SAndroid Build Coastguard Worker    // group resource, we must embed the information of the parent rule
359*d5c09012SAndroid Build Coastguard Worker    // group inside each of the conditions that refer to it. We must also
360*d5c09012SAndroid Build Coastguard Worker    // update the contents of all Prometheus alerts in case the information
361*d5c09012SAndroid Build Coastguard Worker    // of their rule group changes.
362*d5c09012SAndroid Build Coastguard Worker    //
363*d5c09012SAndroid Build Coastguard Worker    // The PrometheusQueryLanguageCondition protocol buffer combines the
364*d5c09012SAndroid Build Coastguard Worker    // information of the corresponding rule group and alerting rule.
365*d5c09012SAndroid Build Coastguard Worker    // The structure of the PrometheusQueryLanguageCondition protocol buffer
366*d5c09012SAndroid Build Coastguard Worker    // does NOT mimic the structure of the Prometheus rule group and alerting
367*d5c09012SAndroid Build Coastguard Worker    // rule YAML declarations. The PrometheusQueryLanguageCondition protocol
368*d5c09012SAndroid Build Coastguard Worker    // buffer may change in the future to support future rule group and/or
369*d5c09012SAndroid Build Coastguard Worker    // alerting rule features. There are no new such features at the present
370*d5c09012SAndroid Build Coastguard Worker    // time (2023-06-26).
371*d5c09012SAndroid Build Coastguard Worker    message PrometheusQueryLanguageCondition {
372*d5c09012SAndroid Build Coastguard Worker      // Required. The PromQL expression to evaluate. Every evaluation cycle
373*d5c09012SAndroid Build Coastguard Worker      // this expression is evaluated at the current time, and all resultant
374*d5c09012SAndroid Build Coastguard Worker      // time series become pending/firing alerts. This field must not be empty.
375*d5c09012SAndroid Build Coastguard Worker      string query = 1 [(google.api.field_behavior) = REQUIRED];
376*d5c09012SAndroid Build Coastguard Worker
377*d5c09012SAndroid Build Coastguard Worker      // Optional. Alerts are considered firing once their PromQL expression was
378*d5c09012SAndroid Build Coastguard Worker      // evaluated to be "true" for this long.
379*d5c09012SAndroid Build Coastguard Worker      // Alerts whose PromQL expression was not evaluated to be "true" for
380*d5c09012SAndroid Build Coastguard Worker      // long enough are considered pending.
381*d5c09012SAndroid Build Coastguard Worker      // Must be a non-negative duration or missing.
382*d5c09012SAndroid Build Coastguard Worker      // This field is optional. Its default value is zero.
383*d5c09012SAndroid Build Coastguard Worker      google.protobuf.Duration duration = 2
384*d5c09012SAndroid Build Coastguard Worker          [(google.api.field_behavior) = OPTIONAL];
385*d5c09012SAndroid Build Coastguard Worker
386*d5c09012SAndroid Build Coastguard Worker      // Optional. How often this rule should be evaluated.
387*d5c09012SAndroid Build Coastguard Worker      // Must be a positive multiple of 30 seconds or missing.
388*d5c09012SAndroid Build Coastguard Worker      // This field is optional. Its default value is 30 seconds.
389*d5c09012SAndroid Build Coastguard Worker      // If this PrometheusQueryLanguageCondition was generated from a
390*d5c09012SAndroid Build Coastguard Worker      // Prometheus alerting rule, then this value should be taken from the
391*d5c09012SAndroid Build Coastguard Worker      // enclosing rule group.
392*d5c09012SAndroid Build Coastguard Worker      google.protobuf.Duration evaluation_interval = 3
393*d5c09012SAndroid Build Coastguard Worker          [(google.api.field_behavior) = OPTIONAL];
394*d5c09012SAndroid Build Coastguard Worker
395*d5c09012SAndroid Build Coastguard Worker      // Optional. Labels to add to or overwrite in the PromQL query result.
396*d5c09012SAndroid Build Coastguard Worker      // Label names [must be
397*d5c09012SAndroid Build Coastguard Worker      // valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
398*d5c09012SAndroid Build Coastguard Worker      // Label values can be [templatized by using
399*d5c09012SAndroid Build Coastguard Worker      // variables](https://cloud.google.com/monitoring/alerts/doc-variables).
400*d5c09012SAndroid Build Coastguard Worker      // The only available variable names are the names of the labels in the
401*d5c09012SAndroid Build Coastguard Worker      // PromQL result, including "__name__" and "value". "labels" may be empty.
402*d5c09012SAndroid Build Coastguard Worker      map<string, string> labels = 4 [(google.api.field_behavior) = OPTIONAL];
403*d5c09012SAndroid Build Coastguard Worker
404*d5c09012SAndroid Build Coastguard Worker      // Optional. The rule group name of this alert in the corresponding
405*d5c09012SAndroid Build Coastguard Worker      // Prometheus configuration file.
406*d5c09012SAndroid Build Coastguard Worker      //
407*d5c09012SAndroid Build Coastguard Worker      // Some external tools may require this field to be populated correctly
408*d5c09012SAndroid Build Coastguard Worker      // in order to refer to the original Prometheus configuration file.
409*d5c09012SAndroid Build Coastguard Worker      // The rule group name and the alert name are necessary to update the
410*d5c09012SAndroid Build Coastguard Worker      // relevant AlertPolicies in case the definition of the rule group changes
411*d5c09012SAndroid Build Coastguard Worker      // in the future.
412*d5c09012SAndroid Build Coastguard Worker      //
413*d5c09012SAndroid Build Coastguard Worker      // This field is optional. If this field is not empty, then it must
414*d5c09012SAndroid Build Coastguard Worker      // contain a valid UTF-8 string.
415*d5c09012SAndroid Build Coastguard Worker      // This field may not exceed 2048 Unicode characters in length.
416*d5c09012SAndroid Build Coastguard Worker      string rule_group = 5 [(google.api.field_behavior) = OPTIONAL];
417*d5c09012SAndroid Build Coastguard Worker
418*d5c09012SAndroid Build Coastguard Worker      // Optional. The alerting rule name of this alert in the corresponding
419*d5c09012SAndroid Build Coastguard Worker      // Prometheus configuration file.
420*d5c09012SAndroid Build Coastguard Worker      //
421*d5c09012SAndroid Build Coastguard Worker      // Some external tools may require this field to be populated correctly
422*d5c09012SAndroid Build Coastguard Worker      // in order to refer to the original Prometheus configuration file.
423*d5c09012SAndroid Build Coastguard Worker      // The rule group name and the alert name are necessary to update the
424*d5c09012SAndroid Build Coastguard Worker      // relevant AlertPolicies in case the definition of the rule group changes
425*d5c09012SAndroid Build Coastguard Worker      // in the future.
426*d5c09012SAndroid Build Coastguard Worker      //
427*d5c09012SAndroid Build Coastguard Worker      // This field is optional. If this field is not empty, then it must be a
428*d5c09012SAndroid Build Coastguard Worker      // [valid Prometheus label
429*d5c09012SAndroid Build Coastguard Worker      // name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
430*d5c09012SAndroid Build Coastguard Worker      // This field may not exceed 2048 Unicode characters in length.
431*d5c09012SAndroid Build Coastguard Worker      string alert_rule = 6 [(google.api.field_behavior) = OPTIONAL];
432*d5c09012SAndroid Build Coastguard Worker    }
433*d5c09012SAndroid Build Coastguard Worker
434*d5c09012SAndroid Build Coastguard Worker    // Required if the condition exists. The unique resource name for this
435*d5c09012SAndroid Build Coastguard Worker    // condition. Its format is:
436*d5c09012SAndroid Build Coastguard Worker    //
437*d5c09012SAndroid Build Coastguard Worker    //     projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
438*d5c09012SAndroid Build Coastguard Worker    //
439*d5c09012SAndroid Build Coastguard Worker    // `[CONDITION_ID]` is assigned by Cloud Monitoring when the
440*d5c09012SAndroid Build Coastguard Worker    // condition is created as part of a new or updated alerting policy.
441*d5c09012SAndroid Build Coastguard Worker    //
442*d5c09012SAndroid Build Coastguard Worker    // When calling the
443*d5c09012SAndroid Build Coastguard Worker    // [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
444*d5c09012SAndroid Build Coastguard Worker    // method, do not include the `name` field in the conditions of the
445*d5c09012SAndroid Build Coastguard Worker    // requested alerting policy. Cloud Monitoring creates the
446*d5c09012SAndroid Build Coastguard Worker    // condition identifiers and includes them in the new policy.
447*d5c09012SAndroid Build Coastguard Worker    //
448*d5c09012SAndroid Build Coastguard Worker    // When calling the
449*d5c09012SAndroid Build Coastguard Worker    // [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy]
450*d5c09012SAndroid Build Coastguard Worker    // method to update a policy, including a condition `name` causes the
451*d5c09012SAndroid Build Coastguard Worker    // existing condition to be updated. Conditions without names are added to
452*d5c09012SAndroid Build Coastguard Worker    // the updated policy. Existing conditions are deleted if they are not
453*d5c09012SAndroid Build Coastguard Worker    // updated.
454*d5c09012SAndroid Build Coastguard Worker    //
455*d5c09012SAndroid Build Coastguard Worker    // Best practice is to preserve `[CONDITION_ID]` if you make only small
456*d5c09012SAndroid Build Coastguard Worker    // changes, such as those to condition thresholds, durations, or trigger
457*d5c09012SAndroid Build Coastguard Worker    // values.  Otherwise, treat the change as a new condition and let the
458*d5c09012SAndroid Build Coastguard Worker    // existing condition be deleted.
459*d5c09012SAndroid Build Coastguard Worker    string name = 12;
460*d5c09012SAndroid Build Coastguard Worker
461*d5c09012SAndroid Build Coastguard Worker    // A short name or phrase used to identify the condition in dashboards,
462*d5c09012SAndroid Build Coastguard Worker    // notifications, and incidents. To avoid confusion, don't use the same
463*d5c09012SAndroid Build Coastguard Worker    // display name for multiple conditions in the same policy.
464*d5c09012SAndroid Build Coastguard Worker    string display_name = 6;
465*d5c09012SAndroid Build Coastguard Worker
466*d5c09012SAndroid Build Coastguard Worker    // Only one of the following condition types will be specified.
467*d5c09012SAndroid Build Coastguard Worker    oneof condition {
468*d5c09012SAndroid Build Coastguard Worker      // A condition that compares a time series against a threshold.
469*d5c09012SAndroid Build Coastguard Worker      MetricThreshold condition_threshold = 1;
470*d5c09012SAndroid Build Coastguard Worker
471*d5c09012SAndroid Build Coastguard Worker      // A condition that checks that a time series continues to
472*d5c09012SAndroid Build Coastguard Worker      // receive new data points.
473*d5c09012SAndroid Build Coastguard Worker      MetricAbsence condition_absent = 2;
474*d5c09012SAndroid Build Coastguard Worker
475*d5c09012SAndroid Build Coastguard Worker      // A condition that checks for log messages matching given constraints. If
476*d5c09012SAndroid Build Coastguard Worker      // set, no other conditions can be present.
477*d5c09012SAndroid Build Coastguard Worker      LogMatch condition_matched_log = 20;
478*d5c09012SAndroid Build Coastguard Worker
479*d5c09012SAndroid Build Coastguard Worker      // A condition that uses the Monitoring Query Language to define
480*d5c09012SAndroid Build Coastguard Worker      // alerts.
481*d5c09012SAndroid Build Coastguard Worker      MonitoringQueryLanguageCondition condition_monitoring_query_language = 19;
482*d5c09012SAndroid Build Coastguard Worker
483*d5c09012SAndroid Build Coastguard Worker      // A condition that uses the Prometheus query language to define alerts.
484*d5c09012SAndroid Build Coastguard Worker      PrometheusQueryLanguageCondition condition_prometheus_query_language = 21;
485*d5c09012SAndroid Build Coastguard Worker    }
486*d5c09012SAndroid Build Coastguard Worker  }
487*d5c09012SAndroid Build Coastguard Worker
488*d5c09012SAndroid Build Coastguard Worker  // Operators for combining conditions.
489*d5c09012SAndroid Build Coastguard Worker  enum ConditionCombinerType {
490*d5c09012SAndroid Build Coastguard Worker    // An unspecified combiner.
491*d5c09012SAndroid Build Coastguard Worker    COMBINE_UNSPECIFIED = 0;
492*d5c09012SAndroid Build Coastguard Worker
493*d5c09012SAndroid Build Coastguard Worker    // Combine conditions using the logical `AND` operator. An
494*d5c09012SAndroid Build Coastguard Worker    // incident is created only if all the conditions are met
495*d5c09012SAndroid Build Coastguard Worker    // simultaneously. This combiner is satisfied if all conditions are
496*d5c09012SAndroid Build Coastguard Worker    // met, even if they are met on completely different resources.
497*d5c09012SAndroid Build Coastguard Worker    AND = 1;
498*d5c09012SAndroid Build Coastguard Worker
499*d5c09012SAndroid Build Coastguard Worker    // Combine conditions using the logical `OR` operator. An incident
500*d5c09012SAndroid Build Coastguard Worker    // is created if any of the listed conditions is met.
501*d5c09012SAndroid Build Coastguard Worker    OR = 2;
502*d5c09012SAndroid Build Coastguard Worker
503*d5c09012SAndroid Build Coastguard Worker    // Combine conditions using logical `AND` operator, but unlike the regular
504*d5c09012SAndroid Build Coastguard Worker    // `AND` option, an incident is created only if all conditions are met
505*d5c09012SAndroid Build Coastguard Worker    // simultaneously on at least one resource.
506*d5c09012SAndroid Build Coastguard Worker    AND_WITH_MATCHING_RESOURCE = 3;
507*d5c09012SAndroid Build Coastguard Worker  }
508*d5c09012SAndroid Build Coastguard Worker
509*d5c09012SAndroid Build Coastguard Worker  // Control over how the notification channels in `notification_channels`
510*d5c09012SAndroid Build Coastguard Worker  // are notified when this alert fires.
511*d5c09012SAndroid Build Coastguard Worker  message AlertStrategy {
512*d5c09012SAndroid Build Coastguard Worker    // Control over the rate of notifications sent to this alert policy's
513*d5c09012SAndroid Build Coastguard Worker    // notification channels.
514*d5c09012SAndroid Build Coastguard Worker    message NotificationRateLimit {
515*d5c09012SAndroid Build Coastguard Worker      // Not more than one notification per `period`.
516*d5c09012SAndroid Build Coastguard Worker      google.protobuf.Duration period = 1;
517*d5c09012SAndroid Build Coastguard Worker    }
518*d5c09012SAndroid Build Coastguard Worker
519*d5c09012SAndroid Build Coastguard Worker    // Control over how the notification channels in `notification_channels`
520*d5c09012SAndroid Build Coastguard Worker    // are notified when this alert fires, on a per-channel basis.
521*d5c09012SAndroid Build Coastguard Worker    message NotificationChannelStrategy {
522*d5c09012SAndroid Build Coastguard Worker      // The full REST resource name for the notification channels that these
523*d5c09012SAndroid Build Coastguard Worker      // settings apply to. Each of these correspond to the name field in one
524*d5c09012SAndroid Build Coastguard Worker      // of the NotificationChannel objects referenced in the
525*d5c09012SAndroid Build Coastguard Worker      // notification_channels field of this AlertPolicy.
526*d5c09012SAndroid Build Coastguard Worker      // The format is:
527*d5c09012SAndroid Build Coastguard Worker      //
528*d5c09012SAndroid Build Coastguard Worker      //     projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
529*d5c09012SAndroid Build Coastguard Worker      repeated string notification_channel_names = 1;
530*d5c09012SAndroid Build Coastguard Worker
531*d5c09012SAndroid Build Coastguard Worker      // The frequency at which to send reminder notifications for open
532*d5c09012SAndroid Build Coastguard Worker      // incidents.
533*d5c09012SAndroid Build Coastguard Worker      google.protobuf.Duration renotify_interval = 2;
534*d5c09012SAndroid Build Coastguard Worker    }
535*d5c09012SAndroid Build Coastguard Worker
536*d5c09012SAndroid Build Coastguard Worker    // Required for alert policies with a `LogMatch` condition.
537*d5c09012SAndroid Build Coastguard Worker    //
538*d5c09012SAndroid Build Coastguard Worker    // This limit is not implemented for alert policies that are not log-based.
539*d5c09012SAndroid Build Coastguard Worker    NotificationRateLimit notification_rate_limit = 1;
540*d5c09012SAndroid Build Coastguard Worker
541*d5c09012SAndroid Build Coastguard Worker    // If an alert policy that was active has no data for this long, any open
542*d5c09012SAndroid Build Coastguard Worker    // incidents will close
543*d5c09012SAndroid Build Coastguard Worker    google.protobuf.Duration auto_close = 3;
544*d5c09012SAndroid Build Coastguard Worker
545*d5c09012SAndroid Build Coastguard Worker    // Control how notifications will be sent out, on a per-channel basis.
546*d5c09012SAndroid Build Coastguard Worker    repeated NotificationChannelStrategy notification_channel_strategy = 4;
547*d5c09012SAndroid Build Coastguard Worker  }
548*d5c09012SAndroid Build Coastguard Worker
549*d5c09012SAndroid Build Coastguard Worker  // An enumeration of possible severity level for an Alert Policy.
550*d5c09012SAndroid Build Coastguard Worker  enum Severity {
551*d5c09012SAndroid Build Coastguard Worker    // No severity is specified. This is the default value.
552*d5c09012SAndroid Build Coastguard Worker    SEVERITY_UNSPECIFIED = 0;
553*d5c09012SAndroid Build Coastguard Worker
554*d5c09012SAndroid Build Coastguard Worker    // This is the highest severity level. Use this if the problem could
555*d5c09012SAndroid Build Coastguard Worker    // cause significant damage or downtime.
556*d5c09012SAndroid Build Coastguard Worker    CRITICAL = 1;
557*d5c09012SAndroid Build Coastguard Worker
558*d5c09012SAndroid Build Coastguard Worker    // This is the medium severity level. Use this if the problem could
559*d5c09012SAndroid Build Coastguard Worker    // cause minor damage or downtime.
560*d5c09012SAndroid Build Coastguard Worker    ERROR = 2;
561*d5c09012SAndroid Build Coastguard Worker
562*d5c09012SAndroid Build Coastguard Worker    // This is the lowest severity level. Use this if the problem is not causing
563*d5c09012SAndroid Build Coastguard Worker    // any damage or downtime, but could potentially lead to a problem in the
564*d5c09012SAndroid Build Coastguard Worker    // future.
565*d5c09012SAndroid Build Coastguard Worker    WARNING = 3;
566*d5c09012SAndroid Build Coastguard Worker  }
567*d5c09012SAndroid Build Coastguard Worker
568*d5c09012SAndroid Build Coastguard Worker  // Required if the policy exists. The resource name for this policy. The
569*d5c09012SAndroid Build Coastguard Worker  // format is:
570*d5c09012SAndroid Build Coastguard Worker  //
571*d5c09012SAndroid Build Coastguard Worker  //     projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
572*d5c09012SAndroid Build Coastguard Worker  //
573*d5c09012SAndroid Build Coastguard Worker  // `[ALERT_POLICY_ID]` is assigned by Cloud Monitoring when the policy
574*d5c09012SAndroid Build Coastguard Worker  // is created. When calling the
575*d5c09012SAndroid Build Coastguard Worker  // [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
576*d5c09012SAndroid Build Coastguard Worker  // method, do not include the `name` field in the alerting policy passed as
577*d5c09012SAndroid Build Coastguard Worker  // part of the request.
578*d5c09012SAndroid Build Coastguard Worker  string name = 1;
579*d5c09012SAndroid Build Coastguard Worker
580*d5c09012SAndroid Build Coastguard Worker  // A short name or phrase used to identify the policy in dashboards,
581*d5c09012SAndroid Build Coastguard Worker  // notifications, and incidents. To avoid confusion, don't use the same
582*d5c09012SAndroid Build Coastguard Worker  // display name for multiple policies in the same project. The name is
583*d5c09012SAndroid Build Coastguard Worker  // limited to 512 Unicode characters.
584*d5c09012SAndroid Build Coastguard Worker  //
585*d5c09012SAndroid Build Coastguard Worker  // The convention for the display_name of a PrometheusQueryLanguageCondition
586*d5c09012SAndroid Build Coastguard Worker  // is "{rule group name}/{alert name}", where the {rule group name} and
587*d5c09012SAndroid Build Coastguard Worker  // {alert name} should be taken from the corresponding Prometheus
588*d5c09012SAndroid Build Coastguard Worker  // configuration file. This convention is not enforced.
589*d5c09012SAndroid Build Coastguard Worker  // In any case the display_name is not a unique key of the AlertPolicy.
590*d5c09012SAndroid Build Coastguard Worker  string display_name = 2;
591*d5c09012SAndroid Build Coastguard Worker
592*d5c09012SAndroid Build Coastguard Worker  // Documentation that is included with notifications and incidents related to
593*d5c09012SAndroid Build Coastguard Worker  // this policy. Best practice is for the documentation to include information
594*d5c09012SAndroid Build Coastguard Worker  // to help responders understand, mitigate, escalate, and correct the
595*d5c09012SAndroid Build Coastguard Worker  // underlying problems detected by the alerting policy. Notification channels
596*d5c09012SAndroid Build Coastguard Worker  // that have limited capacity might not show this documentation.
597*d5c09012SAndroid Build Coastguard Worker  Documentation documentation = 13;
598*d5c09012SAndroid Build Coastguard Worker
599*d5c09012SAndroid Build Coastguard Worker  // User-supplied key/value data to be used for organizing and
600*d5c09012SAndroid Build Coastguard Worker  // identifying the `AlertPolicy` objects.
601*d5c09012SAndroid Build Coastguard Worker  //
602*d5c09012SAndroid Build Coastguard Worker  // The field can contain up to 64 entries. Each key and value is limited to
603*d5c09012SAndroid Build Coastguard Worker  // 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
604*d5c09012SAndroid Build Coastguard Worker  // values can contain only lowercase letters, numerals, underscores, and
605*d5c09012SAndroid Build Coastguard Worker  // dashes. Keys must begin with a letter.
606*d5c09012SAndroid Build Coastguard Worker  //
607*d5c09012SAndroid Build Coastguard Worker  // Note that Prometheus {alert name} is a
608*d5c09012SAndroid Build Coastguard Worker  // [valid Prometheus label
609*d5c09012SAndroid Build Coastguard Worker  // names](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels),
610*d5c09012SAndroid Build Coastguard Worker  // whereas Prometheus {rule group} is an unrestricted UTF-8 string.
611*d5c09012SAndroid Build Coastguard Worker  // This means that they cannot be stored as-is in user labels, because
612*d5c09012SAndroid Build Coastguard Worker  // they may contain characters that are not allowed in user-label values.
613*d5c09012SAndroid Build Coastguard Worker  map<string, string> user_labels = 16;
614*d5c09012SAndroid Build Coastguard Worker
615*d5c09012SAndroid Build Coastguard Worker  // A list of conditions for the policy. The conditions are combined by AND or
616*d5c09012SAndroid Build Coastguard Worker  // OR according to the `combiner` field. If the combined conditions evaluate
617*d5c09012SAndroid Build Coastguard Worker  // to true, then an incident is created. A policy can have from one to six
618*d5c09012SAndroid Build Coastguard Worker  // conditions.
619*d5c09012SAndroid Build Coastguard Worker  // If `condition_time_series_query_language` is present, it must be the only
620*d5c09012SAndroid Build Coastguard Worker  // `condition`.
621*d5c09012SAndroid Build Coastguard Worker  // If `condition_monitoring_query_language` is present, it must be the only
622*d5c09012SAndroid Build Coastguard Worker  // `condition`.
623*d5c09012SAndroid Build Coastguard Worker  repeated Condition conditions = 12;
624*d5c09012SAndroid Build Coastguard Worker
625*d5c09012SAndroid Build Coastguard Worker  // How to combine the results of multiple conditions to determine if an
626*d5c09012SAndroid Build Coastguard Worker  // incident should be opened.
627*d5c09012SAndroid Build Coastguard Worker  // If `condition_time_series_query_language` is present, this must be
628*d5c09012SAndroid Build Coastguard Worker  // `COMBINE_UNSPECIFIED`.
629*d5c09012SAndroid Build Coastguard Worker  ConditionCombinerType combiner = 6;
630*d5c09012SAndroid Build Coastguard Worker
631*d5c09012SAndroid Build Coastguard Worker  // Whether or not the policy is enabled. On write, the default interpretation
632*d5c09012SAndroid Build Coastguard Worker  // if unset is that the policy is enabled. On read, clients should not make
633*d5c09012SAndroid Build Coastguard Worker  // any assumption about the state if it has not been populated. The
634*d5c09012SAndroid Build Coastguard Worker  // field should always be populated on List and Get operations, unless
635*d5c09012SAndroid Build Coastguard Worker  // a field projection has been specified that strips it out.
636*d5c09012SAndroid Build Coastguard Worker  google.protobuf.BoolValue enabled = 17;
637*d5c09012SAndroid Build Coastguard Worker
638*d5c09012SAndroid Build Coastguard Worker  // Read-only description of how the alert policy is invalid. This field is
639*d5c09012SAndroid Build Coastguard Worker  // only set when the alert policy is invalid. An invalid alert policy will not
640*d5c09012SAndroid Build Coastguard Worker  // generate incidents.
641*d5c09012SAndroid Build Coastguard Worker  google.rpc.Status validity = 18;
642*d5c09012SAndroid Build Coastguard Worker
643*d5c09012SAndroid Build Coastguard Worker  // Identifies the notification channels to which notifications should be sent
644*d5c09012SAndroid Build Coastguard Worker  // when incidents are opened or closed or when new violations occur on
645*d5c09012SAndroid Build Coastguard Worker  // an already opened incident. Each element of this array corresponds to
646*d5c09012SAndroid Build Coastguard Worker  // the `name` field in each of the
647*d5c09012SAndroid Build Coastguard Worker  // [`NotificationChannel`][google.monitoring.v3.NotificationChannel]
648*d5c09012SAndroid Build Coastguard Worker  // objects that are returned from the [`ListNotificationChannels`]
649*d5c09012SAndroid Build Coastguard Worker  // [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
650*d5c09012SAndroid Build Coastguard Worker  // method. The format of the entries in this field is:
651*d5c09012SAndroid Build Coastguard Worker  //
652*d5c09012SAndroid Build Coastguard Worker  //     projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
653*d5c09012SAndroid Build Coastguard Worker  repeated string notification_channels = 14;
654*d5c09012SAndroid Build Coastguard Worker
655*d5c09012SAndroid Build Coastguard Worker  // A read-only record of the creation of the alerting policy. If provided
656*d5c09012SAndroid Build Coastguard Worker  // in a call to create or update, this field will be ignored.
657*d5c09012SAndroid Build Coastguard Worker  MutationRecord creation_record = 10;
658*d5c09012SAndroid Build Coastguard Worker
659*d5c09012SAndroid Build Coastguard Worker  // A read-only record of the most recent change to the alerting policy. If
660*d5c09012SAndroid Build Coastguard Worker  // provided in a call to create or update, this field will be ignored.
661*d5c09012SAndroid Build Coastguard Worker  MutationRecord mutation_record = 11;
662*d5c09012SAndroid Build Coastguard Worker
663*d5c09012SAndroid Build Coastguard Worker  // Control over how this alert policy's notification channels are notified.
664*d5c09012SAndroid Build Coastguard Worker  AlertStrategy alert_strategy = 21;
665*d5c09012SAndroid Build Coastguard Worker
666*d5c09012SAndroid Build Coastguard Worker  // Optional. The severity of an alert policy indicates how important incidents
667*d5c09012SAndroid Build Coastguard Worker  // generated by that policy are. The severity level will be displayed on the
668*d5c09012SAndroid Build Coastguard Worker  // Incident detail page and in notifications.
669*d5c09012SAndroid Build Coastguard Worker  Severity severity = 22 [(google.api.field_behavior) = OPTIONAL];
670*d5c09012SAndroid Build Coastguard Worker}
671