Skip to content

Commit 9f7c0ff

Browse files
Google APIscopybara-github
authored andcommitted
feat: Added support for evaluating missing data in AlertPolicy
PiperOrigin-RevId: 465650583
1 parent f91fc46 commit 9f7c0ff

2 files changed

Lines changed: 59 additions & 30 deletions

File tree

google/monitoring/v3/alert.proto

Lines changed: 54 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Google LLC
1+
// Copyright 2022 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -51,7 +51,8 @@ message AlertPolicy {
5151
// The text of the documentation, interpreted according to `mime_type`.
5252
// The content may not exceed 8,192 Unicode characters and may not exceed
5353
// more than 10,240 bytes when encoded in UTF-8 format, whichever is
54-
// smaller.
54+
// smaller. This text can be [templatized by using
55+
// variables](https://cloud.google.com/monitoring/alerts/doc-variables).
5556
string content = 1;
5657

5758
// The format of the `content` field. Presently, only the value
@@ -87,6 +88,26 @@ message AlertPolicy {
8788
}
8889
}
8990

91+
// A condition control that determines how metric-threshold conditions
92+
// are evaluated when data stops arriving.
93+
// This control doesn't affect metric-absence policies.
94+
enum EvaluationMissingData {
95+
// An unspecified evaluation missing data option. Equivalent to
96+
// EVALUATION_MISSING_DATA_NO_OP.
97+
EVALUATION_MISSING_DATA_UNSPECIFIED = 0;
98+
99+
// If there is no data to evaluate the condition, then evaluate the
100+
// condition as false.
101+
EVALUATION_MISSING_DATA_INACTIVE = 1;
102+
103+
// If there is no data to evaluate the condition, then evaluate the
104+
// condition as true.
105+
EVALUATION_MISSING_DATA_ACTIVE = 2;
106+
107+
// Do not evaluate the condition to any value if there is no data.
108+
EVALUATION_MISSING_DATA_NO_OP = 3;
109+
}
110+
90111
// A condition type that compares a collection of time series
91112
// against a threshold.
92113
message MetricThreshold {
@@ -168,6 +189,10 @@ message AlertPolicy {
168189
// or by the ratio, if `denominator_filter` and `denominator_aggregations`
169190
// are specified.
170191
Trigger trigger = 7;
192+
193+
// A condition control that determines how metric-threshold conditions
194+
// are evaluated when data stops arriving.
195+
EvaluationMissingData evaluation_missing_data = 11;
171196
}
172197

173198
// A condition type that checks that monitored resources
@@ -267,20 +292,24 @@ message AlertPolicy {
267292
// or by the ratio, if `denominator_filter` and `denominator_aggregations`
268293
// are specified.
269294
Trigger trigger = 3;
295+
296+
// A condition control that determines how metric-threshold conditions
297+
// are evaluated when data stops arriving.
298+
EvaluationMissingData evaluation_missing_data = 4;
270299
}
271300

272301
// Required if the condition exists. The unique resource name for this
273302
// condition. Its format is:
274303
//
275304
// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
276305
//
277-
// `[CONDITION_ID]` is assigned by Stackdriver Monitoring when the
306+
// `[CONDITION_ID]` is assigned by Cloud Monitoring when the
278307
// condition is created as part of a new or updated alerting policy.
279308
//
280309
// When calling the
281310
// [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
282311
// method, do not include the `name` field in the conditions of the
283-
// requested alerting policy. Stackdriver Monitoring creates the
312+
// requested alerting policy. Cloud Monitoring creates the
284313
// condition identifiers and includes them in the new policy.
285314
//
286315
// When calling the
@@ -320,26 +349,6 @@ message AlertPolicy {
320349
}
321350
}
322351

323-
// Control over how the notification channels in `notification_channels`
324-
// are notified when this alert fires.
325-
message AlertStrategy {
326-
// Control over the rate of notifications sent to this alert policy's
327-
// notification channels.
328-
message NotificationRateLimit {
329-
// Not more than one notification per `period`.
330-
google.protobuf.Duration period = 1;
331-
}
332-
333-
// Required for alert policies with a `LogMatch` condition.
334-
//
335-
// This limit is not implemented for alert policies that are not log-based.
336-
NotificationRateLimit notification_rate_limit = 1;
337-
338-
// If an alert policy that was active has no data for this long, any open
339-
// incidents will close
340-
google.protobuf.Duration auto_close = 3;
341-
}
342-
343352
// Operators for combining conditions.
344353
enum ConditionCombinerType {
345354
// An unspecified combiner.
@@ -361,12 +370,32 @@ message AlertPolicy {
361370
AND_WITH_MATCHING_RESOURCE = 3;
362371
}
363372

373+
// Control over how the notification channels in `notification_channels`
374+
// are notified when this alert fires.
375+
message AlertStrategy {
376+
// Control over the rate of notifications sent to this alert policy's
377+
// notification channels.
378+
message NotificationRateLimit {
379+
// Not more than one notification per `period`.
380+
google.protobuf.Duration period = 1;
381+
}
382+
383+
// Required for alert policies with a `LogMatch` condition.
384+
//
385+
// This limit is not implemented for alert policies that are not log-based.
386+
NotificationRateLimit notification_rate_limit = 1;
387+
388+
// If an alert policy that was active has no data for this long, any open
389+
// incidents will close
390+
google.protobuf.Duration auto_close = 3;
391+
}
392+
364393
// Required if the policy exists. The resource name for this policy. The
365394
// format is:
366395
//
367396
// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
368397
//
369-
// `[ALERT_POLICY_ID]` is assigned by Stackdriver Monitoring when the policy
398+
// `[ALERT_POLICY_ID]` is assigned by Cloud Monitoring when the policy
370399
// is created. When calling the
371400
// [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
372401
// method, do not include the `name` field in the alerting policy passed as

google/monitoring/v3/alert_service.proto

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Google LLC
1+
// Copyright 2022 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -33,14 +33,14 @@ option php_namespace = "Google\\Cloud\\Monitoring\\V3";
3333
option ruby_package = "Google::Cloud::Monitoring::V3";
3434

3535
// The AlertPolicyService API is used to manage (list, create, delete,
36-
// edit) alert policies in Stackdriver Monitoring. An alerting policy is
36+
// edit) alert policies in Cloud Monitoring. An alerting policy is
3737
// a description of the conditions under which some aspect of your
3838
// system is considered to be "unhealthy" and the ways to notify
3939
// people or services about this state. In addition to using this API, alert
4040
// policies can also be managed through
41-
// [Stackdriver Monitoring](https://cloud.google.com/monitoring/docs/),
41+
// [Cloud Monitoring](https://cloud.google.com/monitoring/docs/),
4242
// which can be reached by clicking the "Monitoring" tab in
43-
// [Cloud Console](https://console.cloud.google.com/).
43+
// [Cloud console](https://console.cloud.google.com/).
4444
service AlertPolicyService {
4545
option (google.api.default_host) = "monitoring.googleapis.com";
4646
option (google.api.oauth_scopes) =
@@ -103,7 +103,7 @@ message CreateAlertPolicyRequest {
103103
//
104104
// Note that this field names the parent container in which the alerting
105105
// policy will be written, not the name of the created policy. |name| must be
106-
// a host project of a workspace, otherwise INVALID_ARGUMENT error will
106+
// a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will
107107
// return. The alerting policy that is returned will have a name that contains
108108
// a normalized representation of this name as a prefix but adds a suffix of
109109
// the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the

0 commit comments

Comments
 (0)