Class: Google::Cloud::Monitoring::V3::AlertPolicy

Inherits:
Object
  • Object
show all
Extended by:
Protobuf::MessageExts::ClassMethods
Includes:
Protobuf::MessageExts
Defined in:
proto_docs/google/monitoring/v3/alert.rb

Overview

A description of the conditions under which some aspect of your system is considered to be "unhealthy" and the ways to notify people or services about this state. For an overview of alert policies, see Introduction to Alerting.

Defined Under Namespace

Modules: ConditionCombinerType, Severity Classes: AlertStrategy, Condition, Documentation, UserLabelsEntry

Instance Attribute Summary collapse

Instance Attribute Details

#alert_strategy::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy

Returns Control over how this alert policy's notification channels are notified.

Returns:



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# File 'proto_docs/google/monitoring/v3/alert.rb', line 131

class AlertPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Documentation that is included in the notifications and incidents
  # pertaining to this policy.
  # @!attribute [rw] content
  #   @return [::String]
  #     The body of the documentation, interpreted according to `mime_type`.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller. This text can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  # @!attribute [rw] mime_type
  #   @return [::String]
  #     The format of the `content` field. Presently, only the value
  #     `"text/markdown"` is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  # @!attribute [rw] subject
  #   @return [::String]
  #     Optional. The subject line of the notification. The subject line may not
  #     exceed 10,240 bytes. In notifications generated by this policy, the
  #     contents of the subject line after variable expansion will be truncated
  #     to 255 bytes or shorter at the latest UTF-8 character boundary. The
  #     255-byte limit is recommended by [this
  #     thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit).
  #     It is both the limit imposed by some third-party ticketing products and
  #     it is common to define textual fields in databases as VARCHAR(255).
  #
  #     The contents of the subject line can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  #     If this field is missing or empty, a default subject line will be
  #     generated.
  # @!attribute [rw] links
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::Documentation::Link>]
  #     Optional. Links to content such as playbooks, repositories, and other
  #     resources. This field can contain up to 3 entries.
  class Documentation
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Links to content such as playbooks, repositories, and other resources.
    # @!attribute [rw] display_name
    #   @return [::String]
    #     A short display name for the link. The display name must not be empty
    #     or exceed 63 characters. Example: "playbook".
    # @!attribute [rw] url
    #   @return [::String]
    #     The url of a webpage.
    #     A url can be templatized by using variables
    #     in the path or the query parameters. The total length of a URL should
    #     not exceed 2083 characters before and after variable expansion.
    #     Example: "https://my_domain.com/playbook?name=$\\{resource.name}"
    class Link
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [::String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its format is:
  #
  #         projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     `[CONDITION_ID]` is assigned by Cloud Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#create_alert_policy alertPolicies.create}
  #     method, do not include the `name` field in the conditions of the
  #     requested alerting policy. Cloud Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#update_alert_policy alertPolicies.update}
  #     method to update a policy, including a condition `name` causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve `[CONDITION_ID]` if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [::String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  # @!attribute [rw] condition_matched_log
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::LogMatch]
  #     A condition that checks for log messages matching given constraints. If
  #     set, no other conditions can be present.
  # @!attribute [rw] condition_monitoring_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MonitoringQueryLanguageCondition]
  #     A condition that uses the Monitoring Query Language to define
  #     alerts.
  # @!attribute [rw] condition_prometheus_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition]
  #     A condition that uses the Prometheus query language to define alerts.
  class Condition
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a `{count: 1}` trigger is used.
    # @!attribute [rw] count
    #   @return [::Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [::Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] denominator_filter
    #   @return [::String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies a time series that should be used as the denominator of a
    #     ratio that will be compared with the threshold. If a
    #     `denominator_filter` is specified, the time series specified by the
    #     `filter` field will be used as the numerator.
    #
    #     The filter must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by `denominatorFilter` as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the `aggregations` and
    #     `denominator_aggregations` fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    # @!attribute [rw] forecast_options
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold::ForecastOptions]
    #     When this field is present, the `MetricThreshold` condition forecasts
    #     whether the time series is predicted to violate the threshold within
    #     the `forecast_horizon`. When this field is not set, the
    #     `MetricThreshold` tests the current value of the timeseries against the
    #     threshold.
    # @!attribute [rw] comparison
    #   @return [::Google::Cloud::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by `filter`
    #     and `aggregation`) and the threshold (indicated by `threshold_value`).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [::Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving. To use this control, the value
    #     of the `duration` field must be greater than or equal to 60 seconds.
    class MetricThreshold
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Options used when forecasting the time series and testing
      # the predicted value against the threshold.
      # @!attribute [rw] forecast_horizon
      #   @return [::Google::Protobuf::Duration]
      #     Required. The length of time into the future to forecast whether a
      #     time series will violate the threshold. If the predicted value is
      #     found to violate the threshold, and the violation is observed in all
      #     forecasts made for the configured `duration`, then the time series is
      #     considered to be failing.
      #     The forecast horizon can range from 1 hour to 60 hours.
      class ForecastOptions
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified `duration`.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. The minimum value of this field
    #     is 120 seconds. Larger values that are a multiple of a
    #     minute--for example, 240 or 300 seconds--are supported.
    #     If an invalid value is given, an
    #     error will be returned. The `Duration.nanos` field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`.
    class MetricAbsence
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that checks whether a log message in the [scoping
    # project](https://cloud.google.com/monitoring/api/v3#project_name)
    # satisfies the given filter. Logs from other projects in the metrics
    # scope are not evaluated.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A logs-based filter. See [Advanced Logs
    #     Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
    #     for how this filter should be constructed.
    # @!attribute [rw] label_extractors
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. A map from a label key to an extractor expression, which is
    #     used to extract the value for this label key. Each entry in this map is
    #     a specification for how data should be extracted from log entries that
    #     match `filter`. Each combination of extracted values is treated as a
    #     separate rule for the purposes of triggering notifications. Label keys
    #     and corresponding values can be used in notifications generated by this
    #     condition.
    #
    #     Please see [the documentation on logs-based metric
    #     `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
    #     for syntax and examples.
    class LogMatch
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelExtractorsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that allows alert policies to be defined using
    # [Monitoring Query Language](https://cloud.google.com/monitoring/mql).
    # @!attribute [rw] query
    #   @return [::String]
    #     [Monitoring Query Language](https://cloud.google.com/monitoring/mql)
    #     query that outputs a boolean stream.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving.
    class MonitoringQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that allows alert policies to be defined using
    # [Prometheus Query Language
    # (PromQL)](https://prometheus.io/docs/prometheus/latest/querying/basics/).
    #
    # The PrometheusQueryLanguageCondition message contains information
    # from a Prometheus alerting rule and its associated rule group.
    #
    # A Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/).
    # The semantics of a Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule).
    #
    # A Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
    # The semantics of a Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group).
    #
    # Because Cloud Alerting has no representation of a Prometheus rule
    # group resource, we must embed the information of the parent rule
    # group inside each of the conditions that refer to it. We must also
    # update the contents of all Prometheus alerts in case the information
    # of their rule group changes.
    #
    # The PrometheusQueryLanguageCondition protocol buffer combines the
    # information of the corresponding rule group and alerting rule.
    # The structure of the PrometheusQueryLanguageCondition protocol buffer
    # does NOT mimic the structure of the Prometheus rule group and alerting
    # rule YAML declarations. The PrometheusQueryLanguageCondition protocol
    # buffer may change in the future to support future rule group and/or
    # alerting rule features. There are no new such features at the present
    # time (2023-06-26).
    # @!attribute [rw] query
    #   @return [::String]
    #     Required. The PromQL expression to evaluate. Every evaluation cycle
    #     this expression is evaluated at the current time, and all resultant
    #     time series become pending/firing alerts. This field must not be empty.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     Optional. Alerts are considered firing once their PromQL expression was
    #     evaluated to be "true" for this long.
    #     Alerts whose PromQL expression was not evaluated to be "true" for
    #     long enough are considered pending.
    #     Must be a non-negative duration or missing.
    #     This field is optional. Its default value is zero.
    # @!attribute [rw] evaluation_interval
    #   @return [::Google::Protobuf::Duration]
    #     Optional. How often this rule should be evaluated.
    #     Must be a positive multiple of 30 seconds or missing.
    #     This field is optional. Its default value is 30 seconds.
    #     If this PrometheusQueryLanguageCondition was generated from a
    #     Prometheus alerting rule, then this value should be taken from the
    #     enclosing rule group.
    # @!attribute [rw] labels
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. Labels to add to or overwrite in the PromQL query result.
    #     Label names [must be
    #     valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     Label values can be [templatized by using
    #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
    #     The only available variable names are the names of the labels in the
    #     PromQL result, including "__name__" and "value". "labels" may be empty.
    # @!attribute [rw] rule_group
    #   @return [::String]
    #     Optional. The rule group name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must
    #     contain a valid UTF-8 string.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] alert_rule
    #   @return [::String]
    #     Optional. The alerting rule name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must be a
    #     [valid Prometheus label
    #     name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     This field may not exceed 2048 Unicode characters in length.
    class PrometheusQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition control that determines how metric-threshold conditions
    # are evaluated when data stops arriving.
    # This control doesn't affect metric-absence policies.
    module EvaluationMissingData
      # An unspecified evaluation missing data option.  Equivalent to
      # EVALUATION_MISSING_DATA_NO_OP.
      EVALUATION_MISSING_DATA_UNSPECIFIED = 0

      # If there is no data to evaluate the condition, then evaluate the
      # condition as false.
      EVALUATION_MISSING_DATA_INACTIVE = 1

      # If there is no data to evaluate the condition, then evaluate the
      # condition as true.
      EVALUATION_MISSING_DATA_ACTIVE = 2

      # Do not evaluate the condition to any value if there is no data.
      EVALUATION_MISSING_DATA_NO_OP = 3
    end
  end

  # Control over how the notification channels in `notification_channels`
  # are notified when this alert fires.
  # @!attribute [rw] notification_rate_limit
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationRateLimit]
  #     Required for alert policies with a `LogMatch` condition.
  #
  #     This limit is not implemented for alert policies that are not log-based.
  # @!attribute [rw] auto_close
  #   @return [::Google::Protobuf::Duration]
  #     If an alert policy that was active has no data for this long, any open
  #     incidents will close
  # @!attribute [rw] notification_channel_strategy
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationChannelStrategy>]
  #     Control how notifications will be sent out, on a per-channel basis.
  class AlertStrategy
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Control over the rate of notifications sent to this alert policy's
    # notification channels.
    # @!attribute [rw] period
    #   @return [::Google::Protobuf::Duration]
    #     Not more than one notification per `period`.
    class NotificationRateLimit
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Control over how the notification channels in `notification_channels`
    # are notified when this alert fires, on a per-channel basis.
    # @!attribute [rw] notification_channel_names
    #   @return [::Array<::String>]
    #     The full REST resource name for the notification channels that these
    #     settings apply to. Each of these correspond to the name field in one
    #     of the NotificationChannel objects referenced in the
    #     notification_channels field of this AlertPolicy.
    #     The format is:
    #
    #         projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
    # @!attribute [rw] renotify_interval
    #   @return [::Google::Protobuf::Duration]
    #     The frequency at which to send reminder notifications for open
    #     incidents.
    class NotificationChannelStrategy
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class UserLabelsEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical `AND` operator. An
    # incident is created only if all the conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical `OR` operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical `AND` operator, but unlike the regular
    # `AND` option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end

  # An enumeration of possible severity level for an Alert Policy.
  module Severity
    # No severity is specified. This is the default value.
    SEVERITY_UNSPECIFIED = 0

    # This is the highest severity level. Use this if the problem could
    # cause significant damage or downtime.
    CRITICAL = 1

    # This is the medium severity level. Use this if the problem could
    # cause minor damage or downtime.
    ERROR = 2

    # This is the lowest severity level. Use this if the problem is not causing
    # any damage or downtime, but could potentially lead to a problem in the
    # future.
    WARNING = 3
  end
end

#combiner::Google::Cloud::Monitoring::V3::AlertPolicy::ConditionCombinerType

Returns How to combine the results of multiple conditions to determine if an incident should be opened. If condition_time_series_query_language is present, this must be COMBINE_UNSPECIFIED.

Returns:



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# File 'proto_docs/google/monitoring/v3/alert.rb', line 131

class AlertPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Documentation that is included in the notifications and incidents
  # pertaining to this policy.
  # @!attribute [rw] content
  #   @return [::String]
  #     The body of the documentation, interpreted according to `mime_type`.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller. This text can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  # @!attribute [rw] mime_type
  #   @return [::String]
  #     The format of the `content` field. Presently, only the value
  #     `"text/markdown"` is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  # @!attribute [rw] subject
  #   @return [::String]
  #     Optional. The subject line of the notification. The subject line may not
  #     exceed 10,240 bytes. In notifications generated by this policy, the
  #     contents of the subject line after variable expansion will be truncated
  #     to 255 bytes or shorter at the latest UTF-8 character boundary. The
  #     255-byte limit is recommended by [this
  #     thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit).
  #     It is both the limit imposed by some third-party ticketing products and
  #     it is common to define textual fields in databases as VARCHAR(255).
  #
  #     The contents of the subject line can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  #     If this field is missing or empty, a default subject line will be
  #     generated.
  # @!attribute [rw] links
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::Documentation::Link>]
  #     Optional. Links to content such as playbooks, repositories, and other
  #     resources. This field can contain up to 3 entries.
  class Documentation
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Links to content such as playbooks, repositories, and other resources.
    # @!attribute [rw] display_name
    #   @return [::String]
    #     A short display name for the link. The display name must not be empty
    #     or exceed 63 characters. Example: "playbook".
    # @!attribute [rw] url
    #   @return [::String]
    #     The url of a webpage.
    #     A url can be templatized by using variables
    #     in the path or the query parameters. The total length of a URL should
    #     not exceed 2083 characters before and after variable expansion.
    #     Example: "https://my_domain.com/playbook?name=$\\{resource.name}"
    class Link
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [::String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its format is:
  #
  #         projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     `[CONDITION_ID]` is assigned by Cloud Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#create_alert_policy alertPolicies.create}
  #     method, do not include the `name` field in the conditions of the
  #     requested alerting policy. Cloud Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#update_alert_policy alertPolicies.update}
  #     method to update a policy, including a condition `name` causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve `[CONDITION_ID]` if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [::String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  # @!attribute [rw] condition_matched_log
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::LogMatch]
  #     A condition that checks for log messages matching given constraints. If
  #     set, no other conditions can be present.
  # @!attribute [rw] condition_monitoring_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MonitoringQueryLanguageCondition]
  #     A condition that uses the Monitoring Query Language to define
  #     alerts.
  # @!attribute [rw] condition_prometheus_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition]
  #     A condition that uses the Prometheus query language to define alerts.
  class Condition
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a `{count: 1}` trigger is used.
    # @!attribute [rw] count
    #   @return [::Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [::Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] denominator_filter
    #   @return [::String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies a time series that should be used as the denominator of a
    #     ratio that will be compared with the threshold. If a
    #     `denominator_filter` is specified, the time series specified by the
    #     `filter` field will be used as the numerator.
    #
    #     The filter must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by `denominatorFilter` as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the `aggregations` and
    #     `denominator_aggregations` fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    # @!attribute [rw] forecast_options
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold::ForecastOptions]
    #     When this field is present, the `MetricThreshold` condition forecasts
    #     whether the time series is predicted to violate the threshold within
    #     the `forecast_horizon`. When this field is not set, the
    #     `MetricThreshold` tests the current value of the timeseries against the
    #     threshold.
    # @!attribute [rw] comparison
    #   @return [::Google::Cloud::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by `filter`
    #     and `aggregation`) and the threshold (indicated by `threshold_value`).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [::Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving. To use this control, the value
    #     of the `duration` field must be greater than or equal to 60 seconds.
    class MetricThreshold
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Options used when forecasting the time series and testing
      # the predicted value against the threshold.
      # @!attribute [rw] forecast_horizon
      #   @return [::Google::Protobuf::Duration]
      #     Required. The length of time into the future to forecast whether a
      #     time series will violate the threshold. If the predicted value is
      #     found to violate the threshold, and the violation is observed in all
      #     forecasts made for the configured `duration`, then the time series is
      #     considered to be failing.
      #     The forecast horizon can range from 1 hour to 60 hours.
      class ForecastOptions
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified `duration`.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. The minimum value of this field
    #     is 120 seconds. Larger values that are a multiple of a
    #     minute--for example, 240 or 300 seconds--are supported.
    #     If an invalid value is given, an
    #     error will be returned. The `Duration.nanos` field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`.
    class MetricAbsence
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that checks whether a log message in the [scoping
    # project](https://cloud.google.com/monitoring/api/v3#project_name)
    # satisfies the given filter. Logs from other projects in the metrics
    # scope are not evaluated.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A logs-based filter. See [Advanced Logs
    #     Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
    #     for how this filter should be constructed.
    # @!attribute [rw] label_extractors
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. A map from a label key to an extractor expression, which is
    #     used to extract the value for this label key. Each entry in this map is
    #     a specification for how data should be extracted from log entries that
    #     match `filter`. Each combination of extracted values is treated as a
    #     separate rule for the purposes of triggering notifications. Label keys
    #     and corresponding values can be used in notifications generated by this
    #     condition.
    #
    #     Please see [the documentation on logs-based metric
    #     `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
    #     for syntax and examples.
    class LogMatch
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelExtractorsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that allows alert policies to be defined using
    # [Monitoring Query Language](https://cloud.google.com/monitoring/mql).
    # @!attribute [rw] query
    #   @return [::String]
    #     [Monitoring Query Language](https://cloud.google.com/monitoring/mql)
    #     query that outputs a boolean stream.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving.
    class MonitoringQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that allows alert policies to be defined using
    # [Prometheus Query Language
    # (PromQL)](https://prometheus.io/docs/prometheus/latest/querying/basics/).
    #
    # The PrometheusQueryLanguageCondition message contains information
    # from a Prometheus alerting rule and its associated rule group.
    #
    # A Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/).
    # The semantics of a Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule).
    #
    # A Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
    # The semantics of a Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group).
    #
    # Because Cloud Alerting has no representation of a Prometheus rule
    # group resource, we must embed the information of the parent rule
    # group inside each of the conditions that refer to it. We must also
    # update the contents of all Prometheus alerts in case the information
    # of their rule group changes.
    #
    # The PrometheusQueryLanguageCondition protocol buffer combines the
    # information of the corresponding rule group and alerting rule.
    # The structure of the PrometheusQueryLanguageCondition protocol buffer
    # does NOT mimic the structure of the Prometheus rule group and alerting
    # rule YAML declarations. The PrometheusQueryLanguageCondition protocol
    # buffer may change in the future to support future rule group and/or
    # alerting rule features. There are no new such features at the present
    # time (2023-06-26).
    # @!attribute [rw] query
    #   @return [::String]
    #     Required. The PromQL expression to evaluate. Every evaluation cycle
    #     this expression is evaluated at the current time, and all resultant
    #     time series become pending/firing alerts. This field must not be empty.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     Optional. Alerts are considered firing once their PromQL expression was
    #     evaluated to be "true" for this long.
    #     Alerts whose PromQL expression was not evaluated to be "true" for
    #     long enough are considered pending.
    #     Must be a non-negative duration or missing.
    #     This field is optional. Its default value is zero.
    # @!attribute [rw] evaluation_interval
    #   @return [::Google::Protobuf::Duration]
    #     Optional. How often this rule should be evaluated.
    #     Must be a positive multiple of 30 seconds or missing.
    #     This field is optional. Its default value is 30 seconds.
    #     If this PrometheusQueryLanguageCondition was generated from a
    #     Prometheus alerting rule, then this value should be taken from the
    #     enclosing rule group.
    # @!attribute [rw] labels
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. Labels to add to or overwrite in the PromQL query result.
    #     Label names [must be
    #     valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     Label values can be [templatized by using
    #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
    #     The only available variable names are the names of the labels in the
    #     PromQL result, including "__name__" and "value". "labels" may be empty.
    # @!attribute [rw] rule_group
    #   @return [::String]
    #     Optional. The rule group name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must
    #     contain a valid UTF-8 string.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] alert_rule
    #   @return [::String]
    #     Optional. The alerting rule name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must be a
    #     [valid Prometheus label
    #     name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     This field may not exceed 2048 Unicode characters in length.
    class PrometheusQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition control that determines how metric-threshold conditions
    # are evaluated when data stops arriving.
    # This control doesn't affect metric-absence policies.
    module EvaluationMissingData
      # An unspecified evaluation missing data option.  Equivalent to
      # EVALUATION_MISSING_DATA_NO_OP.
      EVALUATION_MISSING_DATA_UNSPECIFIED = 0

      # If there is no data to evaluate the condition, then evaluate the
      # condition as false.
      EVALUATION_MISSING_DATA_INACTIVE = 1

      # If there is no data to evaluate the condition, then evaluate the
      # condition as true.
      EVALUATION_MISSING_DATA_ACTIVE = 2

      # Do not evaluate the condition to any value if there is no data.
      EVALUATION_MISSING_DATA_NO_OP = 3
    end
  end

  # Control over how the notification channels in `notification_channels`
  # are notified when this alert fires.
  # @!attribute [rw] notification_rate_limit
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationRateLimit]
  #     Required for alert policies with a `LogMatch` condition.
  #
  #     This limit is not implemented for alert policies that are not log-based.
  # @!attribute [rw] auto_close
  #   @return [::Google::Protobuf::Duration]
  #     If an alert policy that was active has no data for this long, any open
  #     incidents will close
  # @!attribute [rw] notification_channel_strategy
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationChannelStrategy>]
  #     Control how notifications will be sent out, on a per-channel basis.
  class AlertStrategy
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Control over the rate of notifications sent to this alert policy's
    # notification channels.
    # @!attribute [rw] period
    #   @return [::Google::Protobuf::Duration]
    #     Not more than one notification per `period`.
    class NotificationRateLimit
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Control over how the notification channels in `notification_channels`
    # are notified when this alert fires, on a per-channel basis.
    # @!attribute [rw] notification_channel_names
    #   @return [::Array<::String>]
    #     The full REST resource name for the notification channels that these
    #     settings apply to. Each of these correspond to the name field in one
    #     of the NotificationChannel objects referenced in the
    #     notification_channels field of this AlertPolicy.
    #     The format is:
    #
    #         projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
    # @!attribute [rw] renotify_interval
    #   @return [::Google::Protobuf::Duration]
    #     The frequency at which to send reminder notifications for open
    #     incidents.
    class NotificationChannelStrategy
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class UserLabelsEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical `AND` operator. An
    # incident is created only if all the conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical `OR` operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical `AND` operator, but unlike the regular
    # `AND` option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end

  # An enumeration of possible severity level for an Alert Policy.
  module Severity
    # No severity is specified. This is the default value.
    SEVERITY_UNSPECIFIED = 0

    # This is the highest severity level. Use this if the problem could
    # cause significant damage or downtime.
    CRITICAL = 1

    # This is the medium severity level. Use this if the problem could
    # cause minor damage or downtime.
    ERROR = 2

    # This is the lowest severity level. Use this if the problem is not causing
    # any damage or downtime, but could potentially lead to a problem in the
    # future.
    WARNING = 3
  end
end

#conditions::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::Condition>

Returns A list of conditions for the policy. The conditions are combined by AND or OR according to the combiner field. If the combined conditions evaluate to true, then an incident is created. A policy can have from one to six conditions. If condition_time_series_query_language is present, it must be the only condition. If condition_monitoring_query_language is present, it must be the only condition.

Returns:

  • (::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::Condition>)

    A list of conditions for the policy. The conditions are combined by AND or OR according to the combiner field. If the combined conditions evaluate to true, then an incident is created. A policy can have from one to six conditions. If condition_time_series_query_language is present, it must be the only condition. If condition_monitoring_query_language is present, it must be the only condition.



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# File 'proto_docs/google/monitoring/v3/alert.rb', line 131

class AlertPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Documentation that is included in the notifications and incidents
  # pertaining to this policy.
  # @!attribute [rw] content
  #   @return [::String]
  #     The body of the documentation, interpreted according to `mime_type`.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller. This text can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  # @!attribute [rw] mime_type
  #   @return [::String]
  #     The format of the `content` field. Presently, only the value
  #     `"text/markdown"` is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  # @!attribute [rw] subject
  #   @return [::String]
  #     Optional. The subject line of the notification. The subject line may not
  #     exceed 10,240 bytes. In notifications generated by this policy, the
  #     contents of the subject line after variable expansion will be truncated
  #     to 255 bytes or shorter at the latest UTF-8 character boundary. The
  #     255-byte limit is recommended by [this
  #     thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit).
  #     It is both the limit imposed by some third-party ticketing products and
  #     it is common to define textual fields in databases as VARCHAR(255).
  #
  #     The contents of the subject line can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  #     If this field is missing or empty, a default subject line will be
  #     generated.
  # @!attribute [rw] links
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::Documentation::Link>]
  #     Optional. Links to content such as playbooks, repositories, and other
  #     resources. This field can contain up to 3 entries.
  class Documentation
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Links to content such as playbooks, repositories, and other resources.
    # @!attribute [rw] display_name
    #   @return [::String]
    #     A short display name for the link. The display name must not be empty
    #     or exceed 63 characters. Example: "playbook".
    # @!attribute [rw] url
    #   @return [::String]
    #     The url of a webpage.
    #     A url can be templatized by using variables
    #     in the path or the query parameters. The total length of a URL should
    #     not exceed 2083 characters before and after variable expansion.
    #     Example: "https://my_domain.com/playbook?name=$\\{resource.name}"
    class Link
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [::String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its format is:
  #
  #         projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     `[CONDITION_ID]` is assigned by Cloud Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#create_alert_policy alertPolicies.create}
  #     method, do not include the `name` field in the conditions of the
  #     requested alerting policy. Cloud Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#update_alert_policy alertPolicies.update}
  #     method to update a policy, including a condition `name` causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve `[CONDITION_ID]` if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [::String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  # @!attribute [rw] condition_matched_log
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::LogMatch]
  #     A condition that checks for log messages matching given constraints. If
  #     set, no other conditions can be present.
  # @!attribute [rw] condition_monitoring_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MonitoringQueryLanguageCondition]
  #     A condition that uses the Monitoring Query Language to define
  #     alerts.
  # @!attribute [rw] condition_prometheus_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition]
  #     A condition that uses the Prometheus query language to define alerts.
  class Condition
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a `{count: 1}` trigger is used.
    # @!attribute [rw] count
    #   @return [::Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [::Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] denominator_filter
    #   @return [::String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies a time series that should be used as the denominator of a
    #     ratio that will be compared with the threshold. If a
    #     `denominator_filter` is specified, the time series specified by the
    #     `filter` field will be used as the numerator.
    #
    #     The filter must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by `denominatorFilter` as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the `aggregations` and
    #     `denominator_aggregations` fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    # @!attribute [rw] forecast_options
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold::ForecastOptions]
    #     When this field is present, the `MetricThreshold` condition forecasts
    #     whether the time series is predicted to violate the threshold within
    #     the `forecast_horizon`. When this field is not set, the
    #     `MetricThreshold` tests the current value of the timeseries against the
    #     threshold.
    # @!attribute [rw] comparison
    #   @return [::Google::Cloud::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by `filter`
    #     and `aggregation`) and the threshold (indicated by `threshold_value`).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [::Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving. To use this control, the value
    #     of the `duration` field must be greater than or equal to 60 seconds.
    class MetricThreshold
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Options used when forecasting the time series and testing
      # the predicted value against the threshold.
      # @!attribute [rw] forecast_horizon
      #   @return [::Google::Protobuf::Duration]
      #     Required. The length of time into the future to forecast whether a
      #     time series will violate the threshold. If the predicted value is
      #     found to violate the threshold, and the violation is observed in all
      #     forecasts made for the configured `duration`, then the time series is
      #     considered to be failing.
      #     The forecast horizon can range from 1 hour to 60 hours.
      class ForecastOptions
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified `duration`.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. The minimum value of this field
    #     is 120 seconds. Larger values that are a multiple of a
    #     minute--for example, 240 or 300 seconds--are supported.
    #     If an invalid value is given, an
    #     error will be returned. The `Duration.nanos` field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`.
    class MetricAbsence
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that checks whether a log message in the [scoping
    # project](https://cloud.google.com/monitoring/api/v3#project_name)
    # satisfies the given filter. Logs from other projects in the metrics
    # scope are not evaluated.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A logs-based filter. See [Advanced Logs
    #     Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
    #     for how this filter should be constructed.
    # @!attribute [rw] label_extractors
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. A map from a label key to an extractor expression, which is
    #     used to extract the value for this label key. Each entry in this map is
    #     a specification for how data should be extracted from log entries that
    #     match `filter`. Each combination of extracted values is treated as a
    #     separate rule for the purposes of triggering notifications. Label keys
    #     and corresponding values can be used in notifications generated by this
    #     condition.
    #
    #     Please see [the documentation on logs-based metric
    #     `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
    #     for syntax and examples.
    class LogMatch
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelExtractorsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that allows alert policies to be defined using
    # [Monitoring Query Language](https://cloud.google.com/monitoring/mql).
    # @!attribute [rw] query
    #   @return [::String]
    #     [Monitoring Query Language](https://cloud.google.com/monitoring/mql)
    #     query that outputs a boolean stream.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving.
    class MonitoringQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that allows alert policies to be defined using
    # [Prometheus Query Language
    # (PromQL)](https://prometheus.io/docs/prometheus/latest/querying/basics/).
    #
    # The PrometheusQueryLanguageCondition message contains information
    # from a Prometheus alerting rule and its associated rule group.
    #
    # A Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/).
    # The semantics of a Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule).
    #
    # A Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
    # The semantics of a Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group).
    #
    # Because Cloud Alerting has no representation of a Prometheus rule
    # group resource, we must embed the information of the parent rule
    # group inside each of the conditions that refer to it. We must also
    # update the contents of all Prometheus alerts in case the information
    # of their rule group changes.
    #
    # The PrometheusQueryLanguageCondition protocol buffer combines the
    # information of the corresponding rule group and alerting rule.
    # The structure of the PrometheusQueryLanguageCondition protocol buffer
    # does NOT mimic the structure of the Prometheus rule group and alerting
    # rule YAML declarations. The PrometheusQueryLanguageCondition protocol
    # buffer may change in the future to support future rule group and/or
    # alerting rule features. There are no new such features at the present
    # time (2023-06-26).
    # @!attribute [rw] query
    #   @return [::String]
    #     Required. The PromQL expression to evaluate. Every evaluation cycle
    #     this expression is evaluated at the current time, and all resultant
    #     time series become pending/firing alerts. This field must not be empty.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     Optional. Alerts are considered firing once their PromQL expression was
    #     evaluated to be "true" for this long.
    #     Alerts whose PromQL expression was not evaluated to be "true" for
    #     long enough are considered pending.
    #     Must be a non-negative duration or missing.
    #     This field is optional. Its default value is zero.
    # @!attribute [rw] evaluation_interval
    #   @return [::Google::Protobuf::Duration]
    #     Optional. How often this rule should be evaluated.
    #     Must be a positive multiple of 30 seconds or missing.
    #     This field is optional. Its default value is 30 seconds.
    #     If this PrometheusQueryLanguageCondition was generated from a
    #     Prometheus alerting rule, then this value should be taken from the
    #     enclosing rule group.
    # @!attribute [rw] labels
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. Labels to add to or overwrite in the PromQL query result.
    #     Label names [must be
    #     valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     Label values can be [templatized by using
    #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
    #     The only available variable names are the names of the labels in the
    #     PromQL result, including "__name__" and "value". "labels" may be empty.
    # @!attribute [rw] rule_group
    #   @return [::String]
    #     Optional. The rule group name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must
    #     contain a valid UTF-8 string.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] alert_rule
    #   @return [::String]
    #     Optional. The alerting rule name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must be a
    #     [valid Prometheus label
    #     name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     This field may not exceed 2048 Unicode characters in length.
    class PrometheusQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition control that determines how metric-threshold conditions
    # are evaluated when data stops arriving.
    # This control doesn't affect metric-absence policies.
    module EvaluationMissingData
      # An unspecified evaluation missing data option.  Equivalent to
      # EVALUATION_MISSING_DATA_NO_OP.
      EVALUATION_MISSING_DATA_UNSPECIFIED = 0

      # If there is no data to evaluate the condition, then evaluate the
      # condition as false.
      EVALUATION_MISSING_DATA_INACTIVE = 1

      # If there is no data to evaluate the condition, then evaluate the
      # condition as true.
      EVALUATION_MISSING_DATA_ACTIVE = 2

      # Do not evaluate the condition to any value if there is no data.
      EVALUATION_MISSING_DATA_NO_OP = 3
    end
  end

  # Control over how the notification channels in `notification_channels`
  # are notified when this alert fires.
  # @!attribute [rw] notification_rate_limit
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationRateLimit]
  #     Required for alert policies with a `LogMatch` condition.
  #
  #     This limit is not implemented for alert policies that are not log-based.
  # @!attribute [rw] auto_close
  #   @return [::Google::Protobuf::Duration]
  #     If an alert policy that was active has no data for this long, any open
  #     incidents will close
  # @!attribute [rw] notification_channel_strategy
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationChannelStrategy>]
  #     Control how notifications will be sent out, on a per-channel basis.
  class AlertStrategy
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Control over the rate of notifications sent to this alert policy's
    # notification channels.
    # @!attribute [rw] period
    #   @return [::Google::Protobuf::Duration]
    #     Not more than one notification per `period`.
    class NotificationRateLimit
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Control over how the notification channels in `notification_channels`
    # are notified when this alert fires, on a per-channel basis.
    # @!attribute [rw] notification_channel_names
    #   @return [::Array<::String>]
    #     The full REST resource name for the notification channels that these
    #     settings apply to. Each of these correspond to the name field in one
    #     of the NotificationChannel objects referenced in the
    #     notification_channels field of this AlertPolicy.
    #     The format is:
    #
    #         projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
    # @!attribute [rw] renotify_interval
    #   @return [::Google::Protobuf::Duration]
    #     The frequency at which to send reminder notifications for open
    #     incidents.
    class NotificationChannelStrategy
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class UserLabelsEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical `AND` operator. An
    # incident is created only if all the conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical `OR` operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical `AND` operator, but unlike the regular
    # `AND` option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end

  # An enumeration of possible severity level for an Alert Policy.
  module Severity
    # No severity is specified. This is the default value.
    SEVERITY_UNSPECIFIED = 0

    # This is the highest severity level. Use this if the problem could
    # cause significant damage or downtime.
    CRITICAL = 1

    # This is the medium severity level. Use this if the problem could
    # cause minor damage or downtime.
    ERROR = 2

    # This is the lowest severity level. Use this if the problem is not causing
    # any damage or downtime, but could potentially lead to a problem in the
    # future.
    WARNING = 3
  end
end

#creation_record::Google::Cloud::Monitoring::V3::MutationRecord

Returns A read-only record of the creation of the alerting policy. If provided in a call to create or update, this field will be ignored.

Returns:



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# File 'proto_docs/google/monitoring/v3/alert.rb', line 131

class AlertPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Documentation that is included in the notifications and incidents
  # pertaining to this policy.
  # @!attribute [rw] content
  #   @return [::String]
  #     The body of the documentation, interpreted according to `mime_type`.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller. This text can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  # @!attribute [rw] mime_type
  #   @return [::String]
  #     The format of the `content` field. Presently, only the value
  #     `"text/markdown"` is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  # @!attribute [rw] subject
  #   @return [::String]
  #     Optional. The subject line of the notification. The subject line may not
  #     exceed 10,240 bytes. In notifications generated by this policy, the
  #     contents of the subject line after variable expansion will be truncated
  #     to 255 bytes or shorter at the latest UTF-8 character boundary. The
  #     255-byte limit is recommended by [this
  #     thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit).
  #     It is both the limit imposed by some third-party ticketing products and
  #     it is common to define textual fields in databases as VARCHAR(255).
  #
  #     The contents of the subject line can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  #     If this field is missing or empty, a default subject line will be
  #     generated.
  # @!attribute [rw] links
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::Documentation::Link>]
  #     Optional. Links to content such as playbooks, repositories, and other
  #     resources. This field can contain up to 3 entries.
  class Documentation
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Links to content such as playbooks, repositories, and other resources.
    # @!attribute [rw] display_name
    #   @return [::String]
    #     A short display name for the link. The display name must not be empty
    #     or exceed 63 characters. Example: "playbook".
    # @!attribute [rw] url
    #   @return [::String]
    #     The url of a webpage.
    #     A url can be templatized by using variables
    #     in the path or the query parameters. The total length of a URL should
    #     not exceed 2083 characters before and after variable expansion.
    #     Example: "https://my_domain.com/playbook?name=$\\{resource.name}"
    class Link
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [::String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its format is:
  #
  #         projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     `[CONDITION_ID]` is assigned by Cloud Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#create_alert_policy alertPolicies.create}
  #     method, do not include the `name` field in the conditions of the
  #     requested alerting policy. Cloud Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#update_alert_policy alertPolicies.update}
  #     method to update a policy, including a condition `name` causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve `[CONDITION_ID]` if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [::String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  # @!attribute [rw] condition_matched_log
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::LogMatch]
  #     A condition that checks for log messages matching given constraints. If
  #     set, no other conditions can be present.
  # @!attribute [rw] condition_monitoring_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MonitoringQueryLanguageCondition]
  #     A condition that uses the Monitoring Query Language to define
  #     alerts.
  # @!attribute [rw] condition_prometheus_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition]
  #     A condition that uses the Prometheus query language to define alerts.
  class Condition
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a `{count: 1}` trigger is used.
    # @!attribute [rw] count
    #   @return [::Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [::Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] denominator_filter
    #   @return [::String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies a time series that should be used as the denominator of a
    #     ratio that will be compared with the threshold. If a
    #     `denominator_filter` is specified, the time series specified by the
    #     `filter` field will be used as the numerator.
    #
    #     The filter must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by `denominatorFilter` as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the `aggregations` and
    #     `denominator_aggregations` fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    # @!attribute [rw] forecast_options
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold::ForecastOptions]
    #     When this field is present, the `MetricThreshold` condition forecasts
    #     whether the time series is predicted to violate the threshold within
    #     the `forecast_horizon`. When this field is not set, the
    #     `MetricThreshold` tests the current value of the timeseries against the
    #     threshold.
    # @!attribute [rw] comparison
    #   @return [::Google::Cloud::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by `filter`
    #     and `aggregation`) and the threshold (indicated by `threshold_value`).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [::Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving. To use this control, the value
    #     of the `duration` field must be greater than or equal to 60 seconds.
    class MetricThreshold
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Options used when forecasting the time series and testing
      # the predicted value against the threshold.
      # @!attribute [rw] forecast_horizon
      #   @return [::Google::Protobuf::Duration]
      #     Required. The length of time into the future to forecast whether a
      #     time series will violate the threshold. If the predicted value is
      #     found to violate the threshold, and the violation is observed in all
      #     forecasts made for the configured `duration`, then the time series is
      #     considered to be failing.
      #     The forecast horizon can range from 1 hour to 60 hours.
      class ForecastOptions
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified `duration`.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. The minimum value of this field
    #     is 120 seconds. Larger values that are a multiple of a
    #     minute--for example, 240 or 300 seconds--are supported.
    #     If an invalid value is given, an
    #     error will be returned. The `Duration.nanos` field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`.
    class MetricAbsence
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that checks whether a log message in the [scoping
    # project](https://cloud.google.com/monitoring/api/v3#project_name)
    # satisfies the given filter. Logs from other projects in the metrics
    # scope are not evaluated.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A logs-based filter. See [Advanced Logs
    #     Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
    #     for how this filter should be constructed.
    # @!attribute [rw] label_extractors
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. A map from a label key to an extractor expression, which is
    #     used to extract the value for this label key. Each entry in this map is
    #     a specification for how data should be extracted from log entries that
    #     match `filter`. Each combination of extracted values is treated as a
    #     separate rule for the purposes of triggering notifications. Label keys
    #     and corresponding values can be used in notifications generated by this
    #     condition.
    #
    #     Please see [the documentation on logs-based metric
    #     `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
    #     for syntax and examples.
    class LogMatch
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelExtractorsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that allows alert policies to be defined using
    # [Monitoring Query Language](https://cloud.google.com/monitoring/mql).
    # @!attribute [rw] query
    #   @return [::String]
    #     [Monitoring Query Language](https://cloud.google.com/monitoring/mql)
    #     query that outputs a boolean stream.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving.
    class MonitoringQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that allows alert policies to be defined using
    # [Prometheus Query Language
    # (PromQL)](https://prometheus.io/docs/prometheus/latest/querying/basics/).
    #
    # The PrometheusQueryLanguageCondition message contains information
    # from a Prometheus alerting rule and its associated rule group.
    #
    # A Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/).
    # The semantics of a Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule).
    #
    # A Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
    # The semantics of a Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group).
    #
    # Because Cloud Alerting has no representation of a Prometheus rule
    # group resource, we must embed the information of the parent rule
    # group inside each of the conditions that refer to it. We must also
    # update the contents of all Prometheus alerts in case the information
    # of their rule group changes.
    #
    # The PrometheusQueryLanguageCondition protocol buffer combines the
    # information of the corresponding rule group and alerting rule.
    # The structure of the PrometheusQueryLanguageCondition protocol buffer
    # does NOT mimic the structure of the Prometheus rule group and alerting
    # rule YAML declarations. The PrometheusQueryLanguageCondition protocol
    # buffer may change in the future to support future rule group and/or
    # alerting rule features. There are no new such features at the present
    # time (2023-06-26).
    # @!attribute [rw] query
    #   @return [::String]
    #     Required. The PromQL expression to evaluate. Every evaluation cycle
    #     this expression is evaluated at the current time, and all resultant
    #     time series become pending/firing alerts. This field must not be empty.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     Optional. Alerts are considered firing once their PromQL expression was
    #     evaluated to be "true" for this long.
    #     Alerts whose PromQL expression was not evaluated to be "true" for
    #     long enough are considered pending.
    #     Must be a non-negative duration or missing.
    #     This field is optional. Its default value is zero.
    # @!attribute [rw] evaluation_interval
    #   @return [::Google::Protobuf::Duration]
    #     Optional. How often this rule should be evaluated.
    #     Must be a positive multiple of 30 seconds or missing.
    #     This field is optional. Its default value is 30 seconds.
    #     If this PrometheusQueryLanguageCondition was generated from a
    #     Prometheus alerting rule, then this value should be taken from the
    #     enclosing rule group.
    # @!attribute [rw] labels
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. Labels to add to or overwrite in the PromQL query result.
    #     Label names [must be
    #     valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     Label values can be [templatized by using
    #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
    #     The only available variable names are the names of the labels in the
    #     PromQL result, including "__name__" and "value". "labels" may be empty.
    # @!attribute [rw] rule_group
    #   @return [::String]
    #     Optional. The rule group name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must
    #     contain a valid UTF-8 string.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] alert_rule
    #   @return [::String]
    #     Optional. The alerting rule name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must be a
    #     [valid Prometheus label
    #     name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     This field may not exceed 2048 Unicode characters in length.
    class PrometheusQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition control that determines how metric-threshold conditions
    # are evaluated when data stops arriving.
    # This control doesn't affect metric-absence policies.
    module EvaluationMissingData
      # An unspecified evaluation missing data option.  Equivalent to
      # EVALUATION_MISSING_DATA_NO_OP.
      EVALUATION_MISSING_DATA_UNSPECIFIED = 0

      # If there is no data to evaluate the condition, then evaluate the
      # condition as false.
      EVALUATION_MISSING_DATA_INACTIVE = 1

      # If there is no data to evaluate the condition, then evaluate the
      # condition as true.
      EVALUATION_MISSING_DATA_ACTIVE = 2

      # Do not evaluate the condition to any value if there is no data.
      EVALUATION_MISSING_DATA_NO_OP = 3
    end
  end

  # Control over how the notification channels in `notification_channels`
  # are notified when this alert fires.
  # @!attribute [rw] notification_rate_limit
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationRateLimit]
  #     Required for alert policies with a `LogMatch` condition.
  #
  #     This limit is not implemented for alert policies that are not log-based.
  # @!attribute [rw] auto_close
  #   @return [::Google::Protobuf::Duration]
  #     If an alert policy that was active has no data for this long, any open
  #     incidents will close
  # @!attribute [rw] notification_channel_strategy
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationChannelStrategy>]
  #     Control how notifications will be sent out, on a per-channel basis.
  class AlertStrategy
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Control over the rate of notifications sent to this alert policy's
    # notification channels.
    # @!attribute [rw] period
    #   @return [::Google::Protobuf::Duration]
    #     Not more than one notification per `period`.
    class NotificationRateLimit
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Control over how the notification channels in `notification_channels`
    # are notified when this alert fires, on a per-channel basis.
    # @!attribute [rw] notification_channel_names
    #   @return [::Array<::String>]
    #     The full REST resource name for the notification channels that these
    #     settings apply to. Each of these correspond to the name field in one
    #     of the NotificationChannel objects referenced in the
    #     notification_channels field of this AlertPolicy.
    #     The format is:
    #
    #         projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
    # @!attribute [rw] renotify_interval
    #   @return [::Google::Protobuf::Duration]
    #     The frequency at which to send reminder notifications for open
    #     incidents.
    class NotificationChannelStrategy
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class UserLabelsEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical `AND` operator. An
    # incident is created only if all the conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical `OR` operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical `AND` operator, but unlike the regular
    # `AND` option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end

  # An enumeration of possible severity level for an Alert Policy.
  module Severity
    # No severity is specified. This is the default value.
    SEVERITY_UNSPECIFIED = 0

    # This is the highest severity level. Use this if the problem could
    # cause significant damage or downtime.
    CRITICAL = 1

    # This is the medium severity level. Use this if the problem could
    # cause minor damage or downtime.
    ERROR = 2

    # This is the lowest severity level. Use this if the problem is not causing
    # any damage or downtime, but could potentially lead to a problem in the
    # future.
    WARNING = 3
  end
end

#display_name::String

Returns A short name or phrase used to identify the policy in dashboards, notifications, and incidents. To avoid confusion, don't use the same display name for multiple policies in the same project. The name is limited to 512 Unicode characters.

The convention for the display_name of a PrometheusQueryLanguageCondition is "{rule group name}/{alert name}", where the {rule group name} and {alert name} should be taken from the corresponding Prometheus configuration file. This convention is not enforced. In any case the display_name is not a unique key of the AlertPolicy.

Returns:

  • (::String)

    A short name or phrase used to identify the policy in dashboards, notifications, and incidents. To avoid confusion, don't use the same display name for multiple policies in the same project. The name is limited to 512 Unicode characters.

    The convention for the display_name of a PrometheusQueryLanguageCondition is "{rule group name}/{alert name}", where the {rule group name} and {alert name} should be taken from the corresponding Prometheus configuration file. This convention is not enforced. In any case the display_name is not a unique key of the AlertPolicy.



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# File 'proto_docs/google/monitoring/v3/alert.rb', line 131

class AlertPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Documentation that is included in the notifications and incidents
  # pertaining to this policy.
  # @!attribute [rw] content
  #   @return [::String]
  #     The body of the documentation, interpreted according to `mime_type`.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller. This text can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  # @!attribute [rw] mime_type
  #   @return [::String]
  #     The format of the `content` field. Presently, only the value
  #     `"text/markdown"` is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  # @!attribute [rw] subject
  #   @return [::String]
  #     Optional. The subject line of the notification. The subject line may not
  #     exceed 10,240 bytes. In notifications generated by this policy, the
  #     contents of the subject line after variable expansion will be truncated
  #     to 255 bytes or shorter at the latest UTF-8 character boundary. The
  #     255-byte limit is recommended by [this
  #     thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit).
  #     It is both the limit imposed by some third-party ticketing products and
  #     it is common to define textual fields in databases as VARCHAR(255).
  #
  #     The contents of the subject line can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  #     If this field is missing or empty, a default subject line will be
  #     generated.
  # @!attribute [rw] links
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::Documentation::Link>]
  #     Optional. Links to content such as playbooks, repositories, and other
  #     resources. This field can contain up to 3 entries.
  class Documentation
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Links to content such as playbooks, repositories, and other resources.
    # @!attribute [rw] display_name
    #   @return [::String]
    #     A short display name for the link. The display name must not be empty
    #     or exceed 63 characters. Example: "playbook".
    # @!attribute [rw] url
    #   @return [::String]
    #     The url of a webpage.
    #     A url can be templatized by using variables
    #     in the path or the query parameters. The total length of a URL should
    #     not exceed 2083 characters before and after variable expansion.
    #     Example: "https://my_domain.com/playbook?name=$\\{resource.name}"
    class Link
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [::String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its format is:
  #
  #         projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     `[CONDITION_ID]` is assigned by Cloud Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#create_alert_policy alertPolicies.create}
  #     method, do not include the `name` field in the conditions of the
  #     requested alerting policy. Cloud Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#update_alert_policy alertPolicies.update}
  #     method to update a policy, including a condition `name` causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve `[CONDITION_ID]` if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [::String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  # @!attribute [rw] condition_matched_log
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::LogMatch]
  #     A condition that checks for log messages matching given constraints. If
  #     set, no other conditions can be present.
  # @!attribute [rw] condition_monitoring_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MonitoringQueryLanguageCondition]
  #     A condition that uses the Monitoring Query Language to define
  #     alerts.
  # @!attribute [rw] condition_prometheus_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition]
  #     A condition that uses the Prometheus query language to define alerts.
  class Condition
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a `{count: 1}` trigger is used.
    # @!attribute [rw] count
    #   @return [::Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [::Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] denominator_filter
    #   @return [::String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies a time series that should be used as the denominator of a
    #     ratio that will be compared with the threshold. If a
    #     `denominator_filter` is specified, the time series specified by the
    #     `filter` field will be used as the numerator.
    #
    #     The filter must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by `denominatorFilter` as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the `aggregations` and
    #     `denominator_aggregations` fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    # @!attribute [rw] forecast_options
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold::ForecastOptions]
    #     When this field is present, the `MetricThreshold` condition forecasts
    #     whether the time series is predicted to violate the threshold within
    #     the `forecast_horizon`. When this field is not set, the
    #     `MetricThreshold` tests the current value of the timeseries against the
    #     threshold.
    # @!attribute [rw] comparison
    #   @return [::Google::Cloud::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by `filter`
    #     and `aggregation`) and the threshold (indicated by `threshold_value`).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [::Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving. To use this control, the value
    #     of the `duration` field must be greater than or equal to 60 seconds.
    class MetricThreshold
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Options used when forecasting the time series and testing
      # the predicted value against the threshold.
      # @!attribute [rw] forecast_horizon
      #   @return [::Google::Protobuf::Duration]
      #     Required. The length of time into the future to forecast whether a
      #     time series will violate the threshold. If the predicted value is
      #     found to violate the threshold, and the violation is observed in all
      #     forecasts made for the configured `duration`, then the time series is
      #     considered to be failing.
      #     The forecast horizon can range from 1 hour to 60 hours.
      class ForecastOptions
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified `duration`.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. The minimum value of this field
    #     is 120 seconds. Larger values that are a multiple of a
    #     minute--for example, 240 or 300 seconds--are supported.
    #     If an invalid value is given, an
    #     error will be returned. The `Duration.nanos` field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`.
    class MetricAbsence
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that checks whether a log message in the [scoping
    # project](https://cloud.google.com/monitoring/api/v3#project_name)
    # satisfies the given filter. Logs from other projects in the metrics
    # scope are not evaluated.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A logs-based filter. See [Advanced Logs
    #     Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
    #     for how this filter should be constructed.
    # @!attribute [rw] label_extractors
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. A map from a label key to an extractor expression, which is
    #     used to extract the value for this label key. Each entry in this map is
    #     a specification for how data should be extracted from log entries that
    #     match `filter`. Each combination of extracted values is treated as a
    #     separate rule for the purposes of triggering notifications. Label keys
    #     and corresponding values can be used in notifications generated by this
    #     condition.
    #
    #     Please see [the documentation on logs-based metric
    #     `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
    #     for syntax and examples.
    class LogMatch
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelExtractorsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that allows alert policies to be defined using
    # [Monitoring Query Language](https://cloud.google.com/monitoring/mql).
    # @!attribute [rw] query
    #   @return [::String]
    #     [Monitoring Query Language](https://cloud.google.com/monitoring/mql)
    #     query that outputs a boolean stream.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving.
    class MonitoringQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that allows alert policies to be defined using
    # [Prometheus Query Language
    # (PromQL)](https://prometheus.io/docs/prometheus/latest/querying/basics/).
    #
    # The PrometheusQueryLanguageCondition message contains information
    # from a Prometheus alerting rule and its associated rule group.
    #
    # A Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/).
    # The semantics of a Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule).
    #
    # A Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
    # The semantics of a Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group).
    #
    # Because Cloud Alerting has no representation of a Prometheus rule
    # group resource, we must embed the information of the parent rule
    # group inside each of the conditions that refer to it. We must also
    # update the contents of all Prometheus alerts in case the information
    # of their rule group changes.
    #
    # The PrometheusQueryLanguageCondition protocol buffer combines the
    # information of the corresponding rule group and alerting rule.
    # The structure of the PrometheusQueryLanguageCondition protocol buffer
    # does NOT mimic the structure of the Prometheus rule group and alerting
    # rule YAML declarations. The PrometheusQueryLanguageCondition protocol
    # buffer may change in the future to support future rule group and/or
    # alerting rule features. There are no new such features at the present
    # time (2023-06-26).
    # @!attribute [rw] query
    #   @return [::String]
    #     Required. The PromQL expression to evaluate. Every evaluation cycle
    #     this expression is evaluated at the current time, and all resultant
    #     time series become pending/firing alerts. This field must not be empty.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     Optional. Alerts are considered firing once their PromQL expression was
    #     evaluated to be "true" for this long.
    #     Alerts whose PromQL expression was not evaluated to be "true" for
    #     long enough are considered pending.
    #     Must be a non-negative duration or missing.
    #     This field is optional. Its default value is zero.
    # @!attribute [rw] evaluation_interval
    #   @return [::Google::Protobuf::Duration]
    #     Optional. How often this rule should be evaluated.
    #     Must be a positive multiple of 30 seconds or missing.
    #     This field is optional. Its default value is 30 seconds.
    #     If this PrometheusQueryLanguageCondition was generated from a
    #     Prometheus alerting rule, then this value should be taken from the
    #     enclosing rule group.
    # @!attribute [rw] labels
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. Labels to add to or overwrite in the PromQL query result.
    #     Label names [must be
    #     valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     Label values can be [templatized by using
    #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
    #     The only available variable names are the names of the labels in the
    #     PromQL result, including "__name__" and "value". "labels" may be empty.
    # @!attribute [rw] rule_group
    #   @return [::String]
    #     Optional. The rule group name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must
    #     contain a valid UTF-8 string.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] alert_rule
    #   @return [::String]
    #     Optional. The alerting rule name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must be a
    #     [valid Prometheus label
    #     name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     This field may not exceed 2048 Unicode characters in length.
    class PrometheusQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition control that determines how metric-threshold conditions
    # are evaluated when data stops arriving.
    # This control doesn't affect metric-absence policies.
    module EvaluationMissingData
      # An unspecified evaluation missing data option.  Equivalent to
      # EVALUATION_MISSING_DATA_NO_OP.
      EVALUATION_MISSING_DATA_UNSPECIFIED = 0

      # If there is no data to evaluate the condition, then evaluate the
      # condition as false.
      EVALUATION_MISSING_DATA_INACTIVE = 1

      # If there is no data to evaluate the condition, then evaluate the
      # condition as true.
      EVALUATION_MISSING_DATA_ACTIVE = 2

      # Do not evaluate the condition to any value if there is no data.
      EVALUATION_MISSING_DATA_NO_OP = 3
    end
  end

  # Control over how the notification channels in `notification_channels`
  # are notified when this alert fires.
  # @!attribute [rw] notification_rate_limit
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationRateLimit]
  #     Required for alert policies with a `LogMatch` condition.
  #
  #     This limit is not implemented for alert policies that are not log-based.
  # @!attribute [rw] auto_close
  #   @return [::Google::Protobuf::Duration]
  #     If an alert policy that was active has no data for this long, any open
  #     incidents will close
  # @!attribute [rw] notification_channel_strategy
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationChannelStrategy>]
  #     Control how notifications will be sent out, on a per-channel basis.
  class AlertStrategy
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Control over the rate of notifications sent to this alert policy's
    # notification channels.
    # @!attribute [rw] period
    #   @return [::Google::Protobuf::Duration]
    #     Not more than one notification per `period`.
    class NotificationRateLimit
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Control over how the notification channels in `notification_channels`
    # are notified when this alert fires, on a per-channel basis.
    # @!attribute [rw] notification_channel_names
    #   @return [::Array<::String>]
    #     The full REST resource name for the notification channels that these
    #     settings apply to. Each of these correspond to the name field in one
    #     of the NotificationChannel objects referenced in the
    #     notification_channels field of this AlertPolicy.
    #     The format is:
    #
    #         projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
    # @!attribute [rw] renotify_interval
    #   @return [::Google::Protobuf::Duration]
    #     The frequency at which to send reminder notifications for open
    #     incidents.
    class NotificationChannelStrategy
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class UserLabelsEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical `AND` operator. An
    # incident is created only if all the conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical `OR` operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical `AND` operator, but unlike the regular
    # `AND` option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end

  # An enumeration of possible severity level for an Alert Policy.
  module Severity
    # No severity is specified. This is the default value.
    SEVERITY_UNSPECIFIED = 0

    # This is the highest severity level. Use this if the problem could
    # cause significant damage or downtime.
    CRITICAL = 1

    # This is the medium severity level. Use this if the problem could
    # cause minor damage or downtime.
    ERROR = 2

    # This is the lowest severity level. Use this if the problem is not causing
    # any damage or downtime, but could potentially lead to a problem in the
    # future.
    WARNING = 3
  end
end

#documentation::Google::Cloud::Monitoring::V3::AlertPolicy::Documentation

Returns Documentation that is included with notifications and incidents related to this policy. Best practice is for the documentation to include information to help responders understand, mitigate, escalate, and correct the underlying problems detected by the alerting policy. Notification channels that have limited capacity might not show this documentation.

Returns:

  • (::Google::Cloud::Monitoring::V3::AlertPolicy::Documentation)

    Documentation that is included with notifications and incidents related to this policy. Best practice is for the documentation to include information to help responders understand, mitigate, escalate, and correct the underlying problems detected by the alerting policy. Notification channels that have limited capacity might not show this documentation.



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# File 'proto_docs/google/monitoring/v3/alert.rb', line 131

class AlertPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Documentation that is included in the notifications and incidents
  # pertaining to this policy.
  # @!attribute [rw] content
  #   @return [::String]
  #     The body of the documentation, interpreted according to `mime_type`.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller. This text can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  # @!attribute [rw] mime_type
  #   @return [::String]
  #     The format of the `content` field. Presently, only the value
  #     `"text/markdown"` is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  # @!attribute [rw] subject
  #   @return [::String]
  #     Optional. The subject line of the notification. The subject line may not
  #     exceed 10,240 bytes. In notifications generated by this policy, the
  #     contents of the subject line after variable expansion will be truncated
  #     to 255 bytes or shorter at the latest UTF-8 character boundary. The
  #     255-byte limit is recommended by [this
  #     thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit).
  #     It is both the limit imposed by some third-party ticketing products and
  #     it is common to define textual fields in databases as VARCHAR(255).
  #
  #     The contents of the subject line can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  #     If this field is missing or empty, a default subject line will be
  #     generated.
  # @!attribute [rw] links
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::Documentation::Link>]
  #     Optional. Links to content such as playbooks, repositories, and other
  #     resources. This field can contain up to 3 entries.
  class Documentation
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Links to content such as playbooks, repositories, and other resources.
    # @!attribute [rw] display_name
    #   @return [::String]
    #     A short display name for the link. The display name must not be empty
    #     or exceed 63 characters. Example: "playbook".
    # @!attribute [rw] url
    #   @return [::String]
    #     The url of a webpage.
    #     A url can be templatized by using variables
    #     in the path or the query parameters. The total length of a URL should
    #     not exceed 2083 characters before and after variable expansion.
    #     Example: "https://my_domain.com/playbook?name=$\\{resource.name}"
    class Link
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [::String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its format is:
  #
  #         projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     `[CONDITION_ID]` is assigned by Cloud Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#create_alert_policy alertPolicies.create}
  #     method, do not include the `name` field in the conditions of the
  #     requested alerting policy. Cloud Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#update_alert_policy alertPolicies.update}
  #     method to update a policy, including a condition `name` causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve `[CONDITION_ID]` if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [::String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  # @!attribute [rw] condition_matched_log
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::LogMatch]
  #     A condition that checks for log messages matching given constraints. If
  #     set, no other conditions can be present.
  # @!attribute [rw] condition_monitoring_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MonitoringQueryLanguageCondition]
  #     A condition that uses the Monitoring Query Language to define
  #     alerts.
  # @!attribute [rw] condition_prometheus_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition]
  #     A condition that uses the Prometheus query language to define alerts.
  class Condition
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a `{count: 1}` trigger is used.
    # @!attribute [rw] count
    #   @return [::Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [::Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] denominator_filter
    #   @return [::String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies a time series that should be used as the denominator of a
    #     ratio that will be compared with the threshold. If a
    #     `denominator_filter` is specified, the time series specified by the
    #     `filter` field will be used as the numerator.
    #
    #     The filter must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by `denominatorFilter` as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the `aggregations` and
    #     `denominator_aggregations` fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    # @!attribute [rw] forecast_options
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold::ForecastOptions]
    #     When this field is present, the `MetricThreshold` condition forecasts
    #     whether the time series is predicted to violate the threshold within
    #     the `forecast_horizon`. When this field is not set, the
    #     `MetricThreshold` tests the current value of the timeseries against the
    #     threshold.
    # @!attribute [rw] comparison
    #   @return [::Google::Cloud::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by `filter`
    #     and `aggregation`) and the threshold (indicated by `threshold_value`).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [::Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving. To use this control, the value
    #     of the `duration` field must be greater than or equal to 60 seconds.
    class MetricThreshold
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Options used when forecasting the time series and testing
      # the predicted value against the threshold.
      # @!attribute [rw] forecast_horizon
      #   @return [::Google::Protobuf::Duration]
      #     Required. The length of time into the future to forecast whether a
      #     time series will violate the threshold. If the predicted value is
      #     found to violate the threshold, and the violation is observed in all
      #     forecasts made for the configured `duration`, then the time series is
      #     considered to be failing.
      #     The forecast horizon can range from 1 hour to 60 hours.
      class ForecastOptions
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified `duration`.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. The minimum value of this field
    #     is 120 seconds. Larger values that are a multiple of a
    #     minute--for example, 240 or 300 seconds--are supported.
    #     If an invalid value is given, an
    #     error will be returned. The `Duration.nanos` field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`.
    class MetricAbsence
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that checks whether a log message in the [scoping
    # project](https://cloud.google.com/monitoring/api/v3#project_name)
    # satisfies the given filter. Logs from other projects in the metrics
    # scope are not evaluated.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A logs-based filter. See [Advanced Logs
    #     Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
    #     for how this filter should be constructed.
    # @!attribute [rw] label_extractors
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. A map from a label key to an extractor expression, which is
    #     used to extract the value for this label key. Each entry in this map is
    #     a specification for how data should be extracted from log entries that
    #     match `filter`. Each combination of extracted values is treated as a
    #     separate rule for the purposes of triggering notifications. Label keys
    #     and corresponding values can be used in notifications generated by this
    #     condition.
    #
    #     Please see [the documentation on logs-based metric
    #     `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
    #     for syntax and examples.
    class LogMatch
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelExtractorsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that allows alert policies to be defined using
    # [Monitoring Query Language](https://cloud.google.com/monitoring/mql).
    # @!attribute [rw] query
    #   @return [::String]
    #     [Monitoring Query Language](https://cloud.google.com/monitoring/mql)
    #     query that outputs a boolean stream.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving.
    class MonitoringQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that allows alert policies to be defined using
    # [Prometheus Query Language
    # (PromQL)](https://prometheus.io/docs/prometheus/latest/querying/basics/).
    #
    # The PrometheusQueryLanguageCondition message contains information
    # from a Prometheus alerting rule and its associated rule group.
    #
    # A Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/).
    # The semantics of a Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule).
    #
    # A Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
    # The semantics of a Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group).
    #
    # Because Cloud Alerting has no representation of a Prometheus rule
    # group resource, we must embed the information of the parent rule
    # group inside each of the conditions that refer to it. We must also
    # update the contents of all Prometheus alerts in case the information
    # of their rule group changes.
    #
    # The PrometheusQueryLanguageCondition protocol buffer combines the
    # information of the corresponding rule group and alerting rule.
    # The structure of the PrometheusQueryLanguageCondition protocol buffer
    # does NOT mimic the structure of the Prometheus rule group and alerting
    # rule YAML declarations. The PrometheusQueryLanguageCondition protocol
    # buffer may change in the future to support future rule group and/or
    # alerting rule features. There are no new such features at the present
    # time (2023-06-26).
    # @!attribute [rw] query
    #   @return [::String]
    #     Required. The PromQL expression to evaluate. Every evaluation cycle
    #     this expression is evaluated at the current time, and all resultant
    #     time series become pending/firing alerts. This field must not be empty.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     Optional. Alerts are considered firing once their PromQL expression was
    #     evaluated to be "true" for this long.
    #     Alerts whose PromQL expression was not evaluated to be "true" for
    #     long enough are considered pending.
    #     Must be a non-negative duration or missing.
    #     This field is optional. Its default value is zero.
    # @!attribute [rw] evaluation_interval
    #   @return [::Google::Protobuf::Duration]
    #     Optional. How often this rule should be evaluated.
    #     Must be a positive multiple of 30 seconds or missing.
    #     This field is optional. Its default value is 30 seconds.
    #     If this PrometheusQueryLanguageCondition was generated from a
    #     Prometheus alerting rule, then this value should be taken from the
    #     enclosing rule group.
    # @!attribute [rw] labels
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. Labels to add to or overwrite in the PromQL query result.
    #     Label names [must be
    #     valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     Label values can be [templatized by using
    #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
    #     The only available variable names are the names of the labels in the
    #     PromQL result, including "__name__" and "value". "labels" may be empty.
    # @!attribute [rw] rule_group
    #   @return [::String]
    #     Optional. The rule group name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must
    #     contain a valid UTF-8 string.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] alert_rule
    #   @return [::String]
    #     Optional. The alerting rule name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must be a
    #     [valid Prometheus label
    #     name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     This field may not exceed 2048 Unicode characters in length.
    class PrometheusQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition control that determines how metric-threshold conditions
    # are evaluated when data stops arriving.
    # This control doesn't affect metric-absence policies.
    module EvaluationMissingData
      # An unspecified evaluation missing data option.  Equivalent to
      # EVALUATION_MISSING_DATA_NO_OP.
      EVALUATION_MISSING_DATA_UNSPECIFIED = 0

      # If there is no data to evaluate the condition, then evaluate the
      # condition as false.
      EVALUATION_MISSING_DATA_INACTIVE = 1

      # If there is no data to evaluate the condition, then evaluate the
      # condition as true.
      EVALUATION_MISSING_DATA_ACTIVE = 2

      # Do not evaluate the condition to any value if there is no data.
      EVALUATION_MISSING_DATA_NO_OP = 3
    end
  end

  # Control over how the notification channels in `notification_channels`
  # are notified when this alert fires.
  # @!attribute [rw] notification_rate_limit
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationRateLimit]
  #     Required for alert policies with a `LogMatch` condition.
  #
  #     This limit is not implemented for alert policies that are not log-based.
  # @!attribute [rw] auto_close
  #   @return [::Google::Protobuf::Duration]
  #     If an alert policy that was active has no data for this long, any open
  #     incidents will close
  # @!attribute [rw] notification_channel_strategy
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationChannelStrategy>]
  #     Control how notifications will be sent out, on a per-channel basis.
  class AlertStrategy
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Control over the rate of notifications sent to this alert policy's
    # notification channels.
    # @!attribute [rw] period
    #   @return [::Google::Protobuf::Duration]
    #     Not more than one notification per `period`.
    class NotificationRateLimit
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Control over how the notification channels in `notification_channels`
    # are notified when this alert fires, on a per-channel basis.
    # @!attribute [rw] notification_channel_names
    #   @return [::Array<::String>]
    #     The full REST resource name for the notification channels that these
    #     settings apply to. Each of these correspond to the name field in one
    #     of the NotificationChannel objects referenced in the
    #     notification_channels field of this AlertPolicy.
    #     The format is:
    #
    #         projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
    # @!attribute [rw] renotify_interval
    #   @return [::Google::Protobuf::Duration]
    #     The frequency at which to send reminder notifications for open
    #     incidents.
    class NotificationChannelStrategy
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class UserLabelsEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical `AND` operator. An
    # incident is created only if all the conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical `OR` operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical `AND` operator, but unlike the regular
    # `AND` option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end

  # An enumeration of possible severity level for an Alert Policy.
  module Severity
    # No severity is specified. This is the default value.
    SEVERITY_UNSPECIFIED = 0

    # This is the highest severity level. Use this if the problem could
    # cause significant damage or downtime.
    CRITICAL = 1

    # This is the medium severity level. Use this if the problem could
    # cause minor damage or downtime.
    ERROR = 2

    # This is the lowest severity level. Use this if the problem is not causing
    # any damage or downtime, but could potentially lead to a problem in the
    # future.
    WARNING = 3
  end
end

#enabled::Google::Protobuf::BoolValue

Returns Whether or not the policy is enabled. On write, the default interpretation if unset is that the policy is enabled. On read, clients should not make any assumption about the state if it has not been populated. The field should always be populated on List and Get operations, unless a field projection has been specified that strips it out.

Returns:

  • (::Google::Protobuf::BoolValue)

    Whether or not the policy is enabled. On write, the default interpretation if unset is that the policy is enabled. On read, clients should not make any assumption about the state if it has not been populated. The field should always be populated on List and Get operations, unless a field projection has been specified that strips it out.



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# File 'proto_docs/google/monitoring/v3/alert.rb', line 131

class AlertPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Documentation that is included in the notifications and incidents
  # pertaining to this policy.
  # @!attribute [rw] content
  #   @return [::String]
  #     The body of the documentation, interpreted according to `mime_type`.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller. This text can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  # @!attribute [rw] mime_type
  #   @return [::String]
  #     The format of the `content` field. Presently, only the value
  #     `"text/markdown"` is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  # @!attribute [rw] subject
  #   @return [::String]
  #     Optional. The subject line of the notification. The subject line may not
  #     exceed 10,240 bytes. In notifications generated by this policy, the
  #     contents of the subject line after variable expansion will be truncated
  #     to 255 bytes or shorter at the latest UTF-8 character boundary. The
  #     255-byte limit is recommended by [this
  #     thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit).
  #     It is both the limit imposed by some third-party ticketing products and
  #     it is common to define textual fields in databases as VARCHAR(255).
  #
  #     The contents of the subject line can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  #     If this field is missing or empty, a default subject line will be
  #     generated.
  # @!attribute [rw] links
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::Documentation::Link>]
  #     Optional. Links to content such as playbooks, repositories, and other
  #     resources. This field can contain up to 3 entries.
  class Documentation
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Links to content such as playbooks, repositories, and other resources.
    # @!attribute [rw] display_name
    #   @return [::String]
    #     A short display name for the link. The display name must not be empty
    #     or exceed 63 characters. Example: "playbook".
    # @!attribute [rw] url
    #   @return [::String]
    #     The url of a webpage.
    #     A url can be templatized by using variables
    #     in the path or the query parameters. The total length of a URL should
    #     not exceed 2083 characters before and after variable expansion.
    #     Example: "https://my_domain.com/playbook?name=$\\{resource.name}"
    class Link
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [::String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its format is:
  #
  #         projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     `[CONDITION_ID]` is assigned by Cloud Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#create_alert_policy alertPolicies.create}
  #     method, do not include the `name` field in the conditions of the
  #     requested alerting policy. Cloud Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#update_alert_policy alertPolicies.update}
  #     method to update a policy, including a condition `name` causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve `[CONDITION_ID]` if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [::String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  # @!attribute [rw] condition_matched_log
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::LogMatch]
  #     A condition that checks for log messages matching given constraints. If
  #     set, no other conditions can be present.
  # @!attribute [rw] condition_monitoring_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MonitoringQueryLanguageCondition]
  #     A condition that uses the Monitoring Query Language to define
  #     alerts.
  # @!attribute [rw] condition_prometheus_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition]
  #     A condition that uses the Prometheus query language to define alerts.
  class Condition
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a `{count: 1}` trigger is used.
    # @!attribute [rw] count
    #   @return [::Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [::Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] denominator_filter
    #   @return [::String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies a time series that should be used as the denominator of a
    #     ratio that will be compared with the threshold. If a
    #     `denominator_filter` is specified, the time series specified by the
    #     `filter` field will be used as the numerator.
    #
    #     The filter must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by `denominatorFilter` as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the `aggregations` and
    #     `denominator_aggregations` fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    # @!attribute [rw] forecast_options
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold::ForecastOptions]
    #     When this field is present, the `MetricThreshold` condition forecasts
    #     whether the time series is predicted to violate the threshold within
    #     the `forecast_horizon`. When this field is not set, the
    #     `MetricThreshold` tests the current value of the timeseries against the
    #     threshold.
    # @!attribute [rw] comparison
    #   @return [::Google::Cloud::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by `filter`
    #     and `aggregation`) and the threshold (indicated by `threshold_value`).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [::Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving. To use this control, the value
    #     of the `duration` field must be greater than or equal to 60 seconds.
    class MetricThreshold
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Options used when forecasting the time series and testing
      # the predicted value against the threshold.
      # @!attribute [rw] forecast_horizon
      #   @return [::Google::Protobuf::Duration]
      #     Required. The length of time into the future to forecast whether a
      #     time series will violate the threshold. If the predicted value is
      #     found to violate the threshold, and the violation is observed in all
      #     forecasts made for the configured `duration`, then the time series is
      #     considered to be failing.
      #     The forecast horizon can range from 1 hour to 60 hours.
      class ForecastOptions
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified `duration`.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. The minimum value of this field
    #     is 120 seconds. Larger values that are a multiple of a
    #     minute--for example, 240 or 300 seconds--are supported.
    #     If an invalid value is given, an
    #     error will be returned. The `Duration.nanos` field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`.
    class MetricAbsence
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that checks whether a log message in the [scoping
    # project](https://cloud.google.com/monitoring/api/v3#project_name)
    # satisfies the given filter. Logs from other projects in the metrics
    # scope are not evaluated.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A logs-based filter. See [Advanced Logs
    #     Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
    #     for how this filter should be constructed.
    # @!attribute [rw] label_extractors
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. A map from a label key to an extractor expression, which is
    #     used to extract the value for this label key. Each entry in this map is
    #     a specification for how data should be extracted from log entries that
    #     match `filter`. Each combination of extracted values is treated as a
    #     separate rule for the purposes of triggering notifications. Label keys
    #     and corresponding values can be used in notifications generated by this
    #     condition.
    #
    #     Please see [the documentation on logs-based metric
    #     `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
    #     for syntax and examples.
    class LogMatch
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelExtractorsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that allows alert policies to be defined using
    # [Monitoring Query Language](https://cloud.google.com/monitoring/mql).
    # @!attribute [rw] query
    #   @return [::String]
    #     [Monitoring Query Language](https://cloud.google.com/monitoring/mql)
    #     query that outputs a boolean stream.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving.
    class MonitoringQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that allows alert policies to be defined using
    # [Prometheus Query Language
    # (PromQL)](https://prometheus.io/docs/prometheus/latest/querying/basics/).
    #
    # The PrometheusQueryLanguageCondition message contains information
    # from a Prometheus alerting rule and its associated rule group.
    #
    # A Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/).
    # The semantics of a Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule).
    #
    # A Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
    # The semantics of a Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group).
    #
    # Because Cloud Alerting has no representation of a Prometheus rule
    # group resource, we must embed the information of the parent rule
    # group inside each of the conditions that refer to it. We must also
    # update the contents of all Prometheus alerts in case the information
    # of their rule group changes.
    #
    # The PrometheusQueryLanguageCondition protocol buffer combines the
    # information of the corresponding rule group and alerting rule.
    # The structure of the PrometheusQueryLanguageCondition protocol buffer
    # does NOT mimic the structure of the Prometheus rule group and alerting
    # rule YAML declarations. The PrometheusQueryLanguageCondition protocol
    # buffer may change in the future to support future rule group and/or
    # alerting rule features. There are no new such features at the present
    # time (2023-06-26).
    # @!attribute [rw] query
    #   @return [::String]
    #     Required. The PromQL expression to evaluate. Every evaluation cycle
    #     this expression is evaluated at the current time, and all resultant
    #     time series become pending/firing alerts. This field must not be empty.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     Optional. Alerts are considered firing once their PromQL expression was
    #     evaluated to be "true" for this long.
    #     Alerts whose PromQL expression was not evaluated to be "true" for
    #     long enough are considered pending.
    #     Must be a non-negative duration or missing.
    #     This field is optional. Its default value is zero.
    # @!attribute [rw] evaluation_interval
    #   @return [::Google::Protobuf::Duration]
    #     Optional. How often this rule should be evaluated.
    #     Must be a positive multiple of 30 seconds or missing.
    #     This field is optional. Its default value is 30 seconds.
    #     If this PrometheusQueryLanguageCondition was generated from a
    #     Prometheus alerting rule, then this value should be taken from the
    #     enclosing rule group.
    # @!attribute [rw] labels
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. Labels to add to or overwrite in the PromQL query result.
    #     Label names [must be
    #     valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     Label values can be [templatized by using
    #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
    #     The only available variable names are the names of the labels in the
    #     PromQL result, including "__name__" and "value". "labels" may be empty.
    # @!attribute [rw] rule_group
    #   @return [::String]
    #     Optional. The rule group name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must
    #     contain a valid UTF-8 string.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] alert_rule
    #   @return [::String]
    #     Optional. The alerting rule name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must be a
    #     [valid Prometheus label
    #     name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     This field may not exceed 2048 Unicode characters in length.
    class PrometheusQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition control that determines how metric-threshold conditions
    # are evaluated when data stops arriving.
    # This control doesn't affect metric-absence policies.
    module EvaluationMissingData
      # An unspecified evaluation missing data option.  Equivalent to
      # EVALUATION_MISSING_DATA_NO_OP.
      EVALUATION_MISSING_DATA_UNSPECIFIED = 0

      # If there is no data to evaluate the condition, then evaluate the
      # condition as false.
      EVALUATION_MISSING_DATA_INACTIVE = 1

      # If there is no data to evaluate the condition, then evaluate the
      # condition as true.
      EVALUATION_MISSING_DATA_ACTIVE = 2

      # Do not evaluate the condition to any value if there is no data.
      EVALUATION_MISSING_DATA_NO_OP = 3
    end
  end

  # Control over how the notification channels in `notification_channels`
  # are notified when this alert fires.
  # @!attribute [rw] notification_rate_limit
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationRateLimit]
  #     Required for alert policies with a `LogMatch` condition.
  #
  #     This limit is not implemented for alert policies that are not log-based.
  # @!attribute [rw] auto_close
  #   @return [::Google::Protobuf::Duration]
  #     If an alert policy that was active has no data for this long, any open
  #     incidents will close
  # @!attribute [rw] notification_channel_strategy
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationChannelStrategy>]
  #     Control how notifications will be sent out, on a per-channel basis.
  class AlertStrategy
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Control over the rate of notifications sent to this alert policy's
    # notification channels.
    # @!attribute [rw] period
    #   @return [::Google::Protobuf::Duration]
    #     Not more than one notification per `period`.
    class NotificationRateLimit
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Control over how the notification channels in `notification_channels`
    # are notified when this alert fires, on a per-channel basis.
    # @!attribute [rw] notification_channel_names
    #   @return [::Array<::String>]
    #     The full REST resource name for the notification channels that these
    #     settings apply to. Each of these correspond to the name field in one
    #     of the NotificationChannel objects referenced in the
    #     notification_channels field of this AlertPolicy.
    #     The format is:
    #
    #         projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
    # @!attribute [rw] renotify_interval
    #   @return [::Google::Protobuf::Duration]
    #     The frequency at which to send reminder notifications for open
    #     incidents.
    class NotificationChannelStrategy
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class UserLabelsEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical `AND` operator. An
    # incident is created only if all the conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical `OR` operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical `AND` operator, but unlike the regular
    # `AND` option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end

  # An enumeration of possible severity level for an Alert Policy.
  module Severity
    # No severity is specified. This is the default value.
    SEVERITY_UNSPECIFIED = 0

    # This is the highest severity level. Use this if the problem could
    # cause significant damage or downtime.
    CRITICAL = 1

    # This is the medium severity level. Use this if the problem could
    # cause minor damage or downtime.
    ERROR = 2

    # This is the lowest severity level. Use this if the problem is not causing
    # any damage or downtime, but could potentially lead to a problem in the
    # future.
    WARNING = 3
  end
end

#mutation_record::Google::Cloud::Monitoring::V3::MutationRecord

Returns A read-only record of the most recent change to the alerting policy. If provided in a call to create or update, this field will be ignored.

Returns:



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# File 'proto_docs/google/monitoring/v3/alert.rb', line 131

class AlertPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Documentation that is included in the notifications and incidents
  # pertaining to this policy.
  # @!attribute [rw] content
  #   @return [::String]
  #     The body of the documentation, interpreted according to `mime_type`.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller. This text can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  # @!attribute [rw] mime_type
  #   @return [::String]
  #     The format of the `content` field. Presently, only the value
  #     `"text/markdown"` is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  # @!attribute [rw] subject
  #   @return [::String]
  #     Optional. The subject line of the notification. The subject line may not
  #     exceed 10,240 bytes. In notifications generated by this policy, the
  #     contents of the subject line after variable expansion will be truncated
  #     to 255 bytes or shorter at the latest UTF-8 character boundary. The
  #     255-byte limit is recommended by [this
  #     thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit).
  #     It is both the limit imposed by some third-party ticketing products and
  #     it is common to define textual fields in databases as VARCHAR(255).
  #
  #     The contents of the subject line can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  #     If this field is missing or empty, a default subject line will be
  #     generated.
  # @!attribute [rw] links
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::Documentation::Link>]
  #     Optional. Links to content such as playbooks, repositories, and other
  #     resources. This field can contain up to 3 entries.
  class Documentation
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Links to content such as playbooks, repositories, and other resources.
    # @!attribute [rw] display_name
    #   @return [::String]
    #     A short display name for the link. The display name must not be empty
    #     or exceed 63 characters. Example: "playbook".
    # @!attribute [rw] url
    #   @return [::String]
    #     The url of a webpage.
    #     A url can be templatized by using variables
    #     in the path or the query parameters. The total length of a URL should
    #     not exceed 2083 characters before and after variable expansion.
    #     Example: "https://my_domain.com/playbook?name=$\\{resource.name}"
    class Link
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [::String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its format is:
  #
  #         projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     `[CONDITION_ID]` is assigned by Cloud Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#create_alert_policy alertPolicies.create}
  #     method, do not include the `name` field in the conditions of the
  #     requested alerting policy. Cloud Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#update_alert_policy alertPolicies.update}
  #     method to update a policy, including a condition `name` causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve `[CONDITION_ID]` if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [::String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  # @!attribute [rw] condition_matched_log
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::LogMatch]
  #     A condition that checks for log messages matching given constraints. If
  #     set, no other conditions can be present.
  # @!attribute [rw] condition_monitoring_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MonitoringQueryLanguageCondition]
  #     A condition that uses the Monitoring Query Language to define
  #     alerts.
  # @!attribute [rw] condition_prometheus_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition]
  #     A condition that uses the Prometheus query language to define alerts.
  class Condition
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a `{count: 1}` trigger is used.
    # @!attribute [rw] count
    #   @return [::Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [::Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] denominator_filter
    #   @return [::String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies a time series that should be used as the denominator of a
    #     ratio that will be compared with the threshold. If a
    #     `denominator_filter` is specified, the time series specified by the
    #     `filter` field will be used as the numerator.
    #
    #     The filter must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by `denominatorFilter` as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the `aggregations` and
    #     `denominator_aggregations` fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    # @!attribute [rw] forecast_options
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold::ForecastOptions]
    #     When this field is present, the `MetricThreshold` condition forecasts
    #     whether the time series is predicted to violate the threshold within
    #     the `forecast_horizon`. When this field is not set, the
    #     `MetricThreshold` tests the current value of the timeseries against the
    #     threshold.
    # @!attribute [rw] comparison
    #   @return [::Google::Cloud::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by `filter`
    #     and `aggregation`) and the threshold (indicated by `threshold_value`).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [::Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving. To use this control, the value
    #     of the `duration` field must be greater than or equal to 60 seconds.
    class MetricThreshold
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Options used when forecasting the time series and testing
      # the predicted value against the threshold.
      # @!attribute [rw] forecast_horizon
      #   @return [::Google::Protobuf::Duration]
      #     Required. The length of time into the future to forecast whether a
      #     time series will violate the threshold. If the predicted value is
      #     found to violate the threshold, and the violation is observed in all
      #     forecasts made for the configured `duration`, then the time series is
      #     considered to be failing.
      #     The forecast horizon can range from 1 hour to 60 hours.
      class ForecastOptions
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified `duration`.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. The minimum value of this field
    #     is 120 seconds. Larger values that are a multiple of a
    #     minute--for example, 240 or 300 seconds--are supported.
    #     If an invalid value is given, an
    #     error will be returned. The `Duration.nanos` field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`.
    class MetricAbsence
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that checks whether a log message in the [scoping
    # project](https://cloud.google.com/monitoring/api/v3#project_name)
    # satisfies the given filter. Logs from other projects in the metrics
    # scope are not evaluated.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A logs-based filter. See [Advanced Logs
    #     Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
    #     for how this filter should be constructed.
    # @!attribute [rw] label_extractors
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. A map from a label key to an extractor expression, which is
    #     used to extract the value for this label key. Each entry in this map is
    #     a specification for how data should be extracted from log entries that
    #     match `filter`. Each combination of extracted values is treated as a
    #     separate rule for the purposes of triggering notifications. Label keys
    #     and corresponding values can be used in notifications generated by this
    #     condition.
    #
    #     Please see [the documentation on logs-based metric
    #     `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
    #     for syntax and examples.
    class LogMatch
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelExtractorsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that allows alert policies to be defined using
    # [Monitoring Query Language](https://cloud.google.com/monitoring/mql).
    # @!attribute [rw] query
    #   @return [::String]
    #     [Monitoring Query Language](https://cloud.google.com/monitoring/mql)
    #     query that outputs a boolean stream.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving.
    class MonitoringQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that allows alert policies to be defined using
    # [Prometheus Query Language
    # (PromQL)](https://prometheus.io/docs/prometheus/latest/querying/basics/).
    #
    # The PrometheusQueryLanguageCondition message contains information
    # from a Prometheus alerting rule and its associated rule group.
    #
    # A Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/).
    # The semantics of a Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule).
    #
    # A Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
    # The semantics of a Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group).
    #
    # Because Cloud Alerting has no representation of a Prometheus rule
    # group resource, we must embed the information of the parent rule
    # group inside each of the conditions that refer to it. We must also
    # update the contents of all Prometheus alerts in case the information
    # of their rule group changes.
    #
    # The PrometheusQueryLanguageCondition protocol buffer combines the
    # information of the corresponding rule group and alerting rule.
    # The structure of the PrometheusQueryLanguageCondition protocol buffer
    # does NOT mimic the structure of the Prometheus rule group and alerting
    # rule YAML declarations. The PrometheusQueryLanguageCondition protocol
    # buffer may change in the future to support future rule group and/or
    # alerting rule features. There are no new such features at the present
    # time (2023-06-26).
    # @!attribute [rw] query
    #   @return [::String]
    #     Required. The PromQL expression to evaluate. Every evaluation cycle
    #     this expression is evaluated at the current time, and all resultant
    #     time series become pending/firing alerts. This field must not be empty.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     Optional. Alerts are considered firing once their PromQL expression was
    #     evaluated to be "true" for this long.
    #     Alerts whose PromQL expression was not evaluated to be "true" for
    #     long enough are considered pending.
    #     Must be a non-negative duration or missing.
    #     This field is optional. Its default value is zero.
    # @!attribute [rw] evaluation_interval
    #   @return [::Google::Protobuf::Duration]
    #     Optional. How often this rule should be evaluated.
    #     Must be a positive multiple of 30 seconds or missing.
    #     This field is optional. Its default value is 30 seconds.
    #     If this PrometheusQueryLanguageCondition was generated from a
    #     Prometheus alerting rule, then this value should be taken from the
    #     enclosing rule group.
    # @!attribute [rw] labels
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. Labels to add to or overwrite in the PromQL query result.
    #     Label names [must be
    #     valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     Label values can be [templatized by using
    #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
    #     The only available variable names are the names of the labels in the
    #     PromQL result, including "__name__" and "value". "labels" may be empty.
    # @!attribute [rw] rule_group
    #   @return [::String]
    #     Optional. The rule group name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must
    #     contain a valid UTF-8 string.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] alert_rule
    #   @return [::String]
    #     Optional. The alerting rule name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must be a
    #     [valid Prometheus label
    #     name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     This field may not exceed 2048 Unicode characters in length.
    class PrometheusQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition control that determines how metric-threshold conditions
    # are evaluated when data stops arriving.
    # This control doesn't affect metric-absence policies.
    module EvaluationMissingData
      # An unspecified evaluation missing data option.  Equivalent to
      # EVALUATION_MISSING_DATA_NO_OP.
      EVALUATION_MISSING_DATA_UNSPECIFIED = 0

      # If there is no data to evaluate the condition, then evaluate the
      # condition as false.
      EVALUATION_MISSING_DATA_INACTIVE = 1

      # If there is no data to evaluate the condition, then evaluate the
      # condition as true.
      EVALUATION_MISSING_DATA_ACTIVE = 2

      # Do not evaluate the condition to any value if there is no data.
      EVALUATION_MISSING_DATA_NO_OP = 3
    end
  end

  # Control over how the notification channels in `notification_channels`
  # are notified when this alert fires.
  # @!attribute [rw] notification_rate_limit
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationRateLimit]
  #     Required for alert policies with a `LogMatch` condition.
  #
  #     This limit is not implemented for alert policies that are not log-based.
  # @!attribute [rw] auto_close
  #   @return [::Google::Protobuf::Duration]
  #     If an alert policy that was active has no data for this long, any open
  #     incidents will close
  # @!attribute [rw] notification_channel_strategy
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationChannelStrategy>]
  #     Control how notifications will be sent out, on a per-channel basis.
  class AlertStrategy
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Control over the rate of notifications sent to this alert policy's
    # notification channels.
    # @!attribute [rw] period
    #   @return [::Google::Protobuf::Duration]
    #     Not more than one notification per `period`.
    class NotificationRateLimit
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Control over how the notification channels in `notification_channels`
    # are notified when this alert fires, on a per-channel basis.
    # @!attribute [rw] notification_channel_names
    #   @return [::Array<::String>]
    #     The full REST resource name for the notification channels that these
    #     settings apply to. Each of these correspond to the name field in one
    #     of the NotificationChannel objects referenced in the
    #     notification_channels field of this AlertPolicy.
    #     The format is:
    #
    #         projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
    # @!attribute [rw] renotify_interval
    #   @return [::Google::Protobuf::Duration]
    #     The frequency at which to send reminder notifications for open
    #     incidents.
    class NotificationChannelStrategy
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class UserLabelsEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical `AND` operator. An
    # incident is created only if all the conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical `OR` operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical `AND` operator, but unlike the regular
    # `AND` option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end

  # An enumeration of possible severity level for an Alert Policy.
  module Severity
    # No severity is specified. This is the default value.
    SEVERITY_UNSPECIFIED = 0

    # This is the highest severity level. Use this if the problem could
    # cause significant damage or downtime.
    CRITICAL = 1

    # This is the medium severity level. Use this if the problem could
    # cause minor damage or downtime.
    ERROR = 2

    # This is the lowest severity level. Use this if the problem is not causing
    # any damage or downtime, but could potentially lead to a problem in the
    # future.
    WARNING = 3
  end
end

#name::String

Returns Required if the policy exists. The resource name for this policy. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

[ALERT_POLICY_ID] is assigned by Cloud Monitoring when the policy is created. When calling the alertPolicies.create method, do not include the name field in the alerting policy passed as part of the request.

Returns:

  • (::String)

    Required if the policy exists. The resource name for this policy. The format is:

    projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
    

    [ALERT_POLICY_ID] is assigned by Cloud Monitoring when the policy is created. When calling the alertPolicies.create method, do not include the name field in the alerting policy passed as part of the request.



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# File 'proto_docs/google/monitoring/v3/alert.rb', line 131

class AlertPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Documentation that is included in the notifications and incidents
  # pertaining to this policy.
  # @!attribute [rw] content
  #   @return [::String]
  #     The body of the documentation, interpreted according to `mime_type`.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller. This text can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  # @!attribute [rw] mime_type
  #   @return [::String]
  #     The format of the `content` field. Presently, only the value
  #     `"text/markdown"` is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  # @!attribute [rw] subject
  #   @return [::String]
  #     Optional. The subject line of the notification. The subject line may not
  #     exceed 10,240 bytes. In notifications generated by this policy, the
  #     contents of the subject line after variable expansion will be truncated
  #     to 255 bytes or shorter at the latest UTF-8 character boundary. The
  #     255-byte limit is recommended by [this
  #     thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit).
  #     It is both the limit imposed by some third-party ticketing products and
  #     it is common to define textual fields in databases as VARCHAR(255).
  #
  #     The contents of the subject line can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  #     If this field is missing or empty, a default subject line will be
  #     generated.
  # @!attribute [rw] links
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::Documentation::Link>]
  #     Optional. Links to content such as playbooks, repositories, and other
  #     resources. This field can contain up to 3 entries.
  class Documentation
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Links to content such as playbooks, repositories, and other resources.
    # @!attribute [rw] display_name
    #   @return [::String]
    #     A short display name for the link. The display name must not be empty
    #     or exceed 63 characters. Example: "playbook".
    # @!attribute [rw] url
    #   @return [::String]
    #     The url of a webpage.
    #     A url can be templatized by using variables
    #     in the path or the query parameters. The total length of a URL should
    #     not exceed 2083 characters before and after variable expansion.
    #     Example: "https://my_domain.com/playbook?name=$\\{resource.name}"
    class Link
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [::String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its format is:
  #
  #         projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     `[CONDITION_ID]` is assigned by Cloud Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#create_alert_policy alertPolicies.create}
  #     method, do not include the `name` field in the conditions of the
  #     requested alerting policy. Cloud Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#update_alert_policy alertPolicies.update}
  #     method to update a policy, including a condition `name` causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve `[CONDITION_ID]` if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [::String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  # @!attribute [rw] condition_matched_log
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::LogMatch]
  #     A condition that checks for log messages matching given constraints. If
  #     set, no other conditions can be present.
  # @!attribute [rw] condition_monitoring_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MonitoringQueryLanguageCondition]
  #     A condition that uses the Monitoring Query Language to define
  #     alerts.
  # @!attribute [rw] condition_prometheus_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition]
  #     A condition that uses the Prometheus query language to define alerts.
  class Condition
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a `{count: 1}` trigger is used.
    # @!attribute [rw] count
    #   @return [::Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [::Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] denominator_filter
    #   @return [::String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies a time series that should be used as the denominator of a
    #     ratio that will be compared with the threshold. If a
    #     `denominator_filter` is specified, the time series specified by the
    #     `filter` field will be used as the numerator.
    #
    #     The filter must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by `denominatorFilter` as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the `aggregations` and
    #     `denominator_aggregations` fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    # @!attribute [rw] forecast_options
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold::ForecastOptions]
    #     When this field is present, the `MetricThreshold` condition forecasts
    #     whether the time series is predicted to violate the threshold within
    #     the `forecast_horizon`. When this field is not set, the
    #     `MetricThreshold` tests the current value of the timeseries against the
    #     threshold.
    # @!attribute [rw] comparison
    #   @return [::Google::Cloud::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by `filter`
    #     and `aggregation`) and the threshold (indicated by `threshold_value`).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [::Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving. To use this control, the value
    #     of the `duration` field must be greater than or equal to 60 seconds.
    class MetricThreshold
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Options used when forecasting the time series and testing
      # the predicted value against the threshold.
      # @!attribute [rw] forecast_horizon
      #   @return [::Google::Protobuf::Duration]
      #     Required. The length of time into the future to forecast whether a
      #     time series will violate the threshold. If the predicted value is
      #     found to violate the threshold, and the violation is observed in all
      #     forecasts made for the configured `duration`, then the time series is
      #     considered to be failing.
      #     The forecast horizon can range from 1 hour to 60 hours.
      class ForecastOptions
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified `duration`.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. The minimum value of this field
    #     is 120 seconds. Larger values that are a multiple of a
    #     minute--for example, 240 or 300 seconds--are supported.
    #     If an invalid value is given, an
    #     error will be returned. The `Duration.nanos` field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`.
    class MetricAbsence
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that checks whether a log message in the [scoping
    # project](https://cloud.google.com/monitoring/api/v3#project_name)
    # satisfies the given filter. Logs from other projects in the metrics
    # scope are not evaluated.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A logs-based filter. See [Advanced Logs
    #     Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
    #     for how this filter should be constructed.
    # @!attribute [rw] label_extractors
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. A map from a label key to an extractor expression, which is
    #     used to extract the value for this label key. Each entry in this map is
    #     a specification for how data should be extracted from log entries that
    #     match `filter`. Each combination of extracted values is treated as a
    #     separate rule for the purposes of triggering notifications. Label keys
    #     and corresponding values can be used in notifications generated by this
    #     condition.
    #
    #     Please see [the documentation on logs-based metric
    #     `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
    #     for syntax and examples.
    class LogMatch
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelExtractorsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that allows alert policies to be defined using
    # [Monitoring Query Language](https://cloud.google.com/monitoring/mql).
    # @!attribute [rw] query
    #   @return [::String]
    #     [Monitoring Query Language](https://cloud.google.com/monitoring/mql)
    #     query that outputs a boolean stream.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving.
    class MonitoringQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that allows alert policies to be defined using
    # [Prometheus Query Language
    # (PromQL)](https://prometheus.io/docs/prometheus/latest/querying/basics/).
    #
    # The PrometheusQueryLanguageCondition message contains information
    # from a Prometheus alerting rule and its associated rule group.
    #
    # A Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/).
    # The semantics of a Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule).
    #
    # A Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
    # The semantics of a Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group).
    #
    # Because Cloud Alerting has no representation of a Prometheus rule
    # group resource, we must embed the information of the parent rule
    # group inside each of the conditions that refer to it. We must also
    # update the contents of all Prometheus alerts in case the information
    # of their rule group changes.
    #
    # The PrometheusQueryLanguageCondition protocol buffer combines the
    # information of the corresponding rule group and alerting rule.
    # The structure of the PrometheusQueryLanguageCondition protocol buffer
    # does NOT mimic the structure of the Prometheus rule group and alerting
    # rule YAML declarations. The PrometheusQueryLanguageCondition protocol
    # buffer may change in the future to support future rule group and/or
    # alerting rule features. There are no new such features at the present
    # time (2023-06-26).
    # @!attribute [rw] query
    #   @return [::String]
    #     Required. The PromQL expression to evaluate. Every evaluation cycle
    #     this expression is evaluated at the current time, and all resultant
    #     time series become pending/firing alerts. This field must not be empty.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     Optional. Alerts are considered firing once their PromQL expression was
    #     evaluated to be "true" for this long.
    #     Alerts whose PromQL expression was not evaluated to be "true" for
    #     long enough are considered pending.
    #     Must be a non-negative duration or missing.
    #     This field is optional. Its default value is zero.
    # @!attribute [rw] evaluation_interval
    #   @return [::Google::Protobuf::Duration]
    #     Optional. How often this rule should be evaluated.
    #     Must be a positive multiple of 30 seconds or missing.
    #     This field is optional. Its default value is 30 seconds.
    #     If this PrometheusQueryLanguageCondition was generated from a
    #     Prometheus alerting rule, then this value should be taken from the
    #     enclosing rule group.
    # @!attribute [rw] labels
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. Labels to add to or overwrite in the PromQL query result.
    #     Label names [must be
    #     valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     Label values can be [templatized by using
    #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
    #     The only available variable names are the names of the labels in the
    #     PromQL result, including "__name__" and "value". "labels" may be empty.
    # @!attribute [rw] rule_group
    #   @return [::String]
    #     Optional. The rule group name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must
    #     contain a valid UTF-8 string.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] alert_rule
    #   @return [::String]
    #     Optional. The alerting rule name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must be a
    #     [valid Prometheus label
    #     name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     This field may not exceed 2048 Unicode characters in length.
    class PrometheusQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition control that determines how metric-threshold conditions
    # are evaluated when data stops arriving.
    # This control doesn't affect metric-absence policies.
    module EvaluationMissingData
      # An unspecified evaluation missing data option.  Equivalent to
      # EVALUATION_MISSING_DATA_NO_OP.
      EVALUATION_MISSING_DATA_UNSPECIFIED = 0

      # If there is no data to evaluate the condition, then evaluate the
      # condition as false.
      EVALUATION_MISSING_DATA_INACTIVE = 1

      # If there is no data to evaluate the condition, then evaluate the
      # condition as true.
      EVALUATION_MISSING_DATA_ACTIVE = 2

      # Do not evaluate the condition to any value if there is no data.
      EVALUATION_MISSING_DATA_NO_OP = 3
    end
  end

  # Control over how the notification channels in `notification_channels`
  # are notified when this alert fires.
  # @!attribute [rw] notification_rate_limit
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationRateLimit]
  #     Required for alert policies with a `LogMatch` condition.
  #
  #     This limit is not implemented for alert policies that are not log-based.
  # @!attribute [rw] auto_close
  #   @return [::Google::Protobuf::Duration]
  #     If an alert policy that was active has no data for this long, any open
  #     incidents will close
  # @!attribute [rw] notification_channel_strategy
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationChannelStrategy>]
  #     Control how notifications will be sent out, on a per-channel basis.
  class AlertStrategy
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Control over the rate of notifications sent to this alert policy's
    # notification channels.
    # @!attribute [rw] period
    #   @return [::Google::Protobuf::Duration]
    #     Not more than one notification per `period`.
    class NotificationRateLimit
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Control over how the notification channels in `notification_channels`
    # are notified when this alert fires, on a per-channel basis.
    # @!attribute [rw] notification_channel_names
    #   @return [::Array<::String>]
    #     The full REST resource name for the notification channels that these
    #     settings apply to. Each of these correspond to the name field in one
    #     of the NotificationChannel objects referenced in the
    #     notification_channels field of this AlertPolicy.
    #     The format is:
    #
    #         projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
    # @!attribute [rw] renotify_interval
    #   @return [::Google::Protobuf::Duration]
    #     The frequency at which to send reminder notifications for open
    #     incidents.
    class NotificationChannelStrategy
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class UserLabelsEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical `AND` operator. An
    # incident is created only if all the conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical `OR` operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical `AND` operator, but unlike the regular
    # `AND` option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end

  # An enumeration of possible severity level for an Alert Policy.
  module Severity
    # No severity is specified. This is the default value.
    SEVERITY_UNSPECIFIED = 0

    # This is the highest severity level. Use this if the problem could
    # cause significant damage or downtime.
    CRITICAL = 1

    # This is the medium severity level. Use this if the problem could
    # cause minor damage or downtime.
    ERROR = 2

    # This is the lowest severity level. Use this if the problem is not causing
    # any damage or downtime, but could potentially lead to a problem in the
    # future.
    WARNING = 3
  end
end

#notification_channels::Array<::String>

Returns Identifies the notification channels to which notifications should be sent when incidents are opened or closed or when new violations occur on an already opened incident. Each element of this array corresponds to the name field in each of the NotificationChannel objects that are returned from the [ListNotificationChannels] [google.monitoring.v3.NotificationChannelService.ListNotificationChannels] method. The format of the entries in this field is:

projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID].

Returns:

  • (::Array<::String>)

    Identifies the notification channels to which notifications should be sent when incidents are opened or closed or when new violations occur on an already opened incident. Each element of this array corresponds to the name field in each of the NotificationChannel objects that are returned from the [ListNotificationChannels] [google.monitoring.v3.NotificationChannelService.ListNotificationChannels] method. The format of the entries in this field is:

    projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
    


131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# File 'proto_docs/google/monitoring/v3/alert.rb', line 131

class AlertPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Documentation that is included in the notifications and incidents
  # pertaining to this policy.
  # @!attribute [rw] content
  #   @return [::String]
  #     The body of the documentation, interpreted according to `mime_type`.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller. This text can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  # @!attribute [rw] mime_type
  #   @return [::String]
  #     The format of the `content` field. Presently, only the value
  #     `"text/markdown"` is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  # @!attribute [rw] subject
  #   @return [::String]
  #     Optional. The subject line of the notification. The subject line may not
  #     exceed 10,240 bytes. In notifications generated by this policy, the
  #     contents of the subject line after variable expansion will be truncated
  #     to 255 bytes or shorter at the latest UTF-8 character boundary. The
  #     255-byte limit is recommended by [this
  #     thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit).
  #     It is both the limit imposed by some third-party ticketing products and
  #     it is common to define textual fields in databases as VARCHAR(255).
  #
  #     The contents of the subject line can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  #     If this field is missing or empty, a default subject line will be
  #     generated.
  # @!attribute [rw] links
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::Documentation::Link>]
  #     Optional. Links to content such as playbooks, repositories, and other
  #     resources. This field can contain up to 3 entries.
  class Documentation
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Links to content such as playbooks, repositories, and other resources.
    # @!attribute [rw] display_name
    #   @return [::String]
    #     A short display name for the link. The display name must not be empty
    #     or exceed 63 characters. Example: "playbook".
    # @!attribute [rw] url
    #   @return [::String]
    #     The url of a webpage.
    #     A url can be templatized by using variables
    #     in the path or the query parameters. The total length of a URL should
    #     not exceed 2083 characters before and after variable expansion.
    #     Example: "https://my_domain.com/playbook?name=$\\{resource.name}"
    class Link
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [::String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its format is:
  #
  #         projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     `[CONDITION_ID]` is assigned by Cloud Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#create_alert_policy alertPolicies.create}
  #     method, do not include the `name` field in the conditions of the
  #     requested alerting policy. Cloud Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#update_alert_policy alertPolicies.update}
  #     method to update a policy, including a condition `name` causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve `[CONDITION_ID]` if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [::String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  # @!attribute [rw] condition_matched_log
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::LogMatch]
  #     A condition that checks for log messages matching given constraints. If
  #     set, no other conditions can be present.
  # @!attribute [rw] condition_monitoring_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MonitoringQueryLanguageCondition]
  #     A condition that uses the Monitoring Query Language to define
  #     alerts.
  # @!attribute [rw] condition_prometheus_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition]
  #     A condition that uses the Prometheus query language to define alerts.
  class Condition
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a `{count: 1}` trigger is used.
    # @!attribute [rw] count
    #   @return [::Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [::Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] denominator_filter
    #   @return [::String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies a time series that should be used as the denominator of a
    #     ratio that will be compared with the threshold. If a
    #     `denominator_filter` is specified, the time series specified by the
    #     `filter` field will be used as the numerator.
    #
    #     The filter must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by `denominatorFilter` as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the `aggregations` and
    #     `denominator_aggregations` fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    # @!attribute [rw] forecast_options
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold::ForecastOptions]
    #     When this field is present, the `MetricThreshold` condition forecasts
    #     whether the time series is predicted to violate the threshold within
    #     the `forecast_horizon`. When this field is not set, the
    #     `MetricThreshold` tests the current value of the timeseries against the
    #     threshold.
    # @!attribute [rw] comparison
    #   @return [::Google::Cloud::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by `filter`
    #     and `aggregation`) and the threshold (indicated by `threshold_value`).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [::Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving. To use this control, the value
    #     of the `duration` field must be greater than or equal to 60 seconds.
    class MetricThreshold
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Options used when forecasting the time series and testing
      # the predicted value against the threshold.
      # @!attribute [rw] forecast_horizon
      #   @return [::Google::Protobuf::Duration]
      #     Required. The length of time into the future to forecast whether a
      #     time series will violate the threshold. If the predicted value is
      #     found to violate the threshold, and the violation is observed in all
      #     forecasts made for the configured `duration`, then the time series is
      #     considered to be failing.
      #     The forecast horizon can range from 1 hour to 60 hours.
      class ForecastOptions
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified `duration`.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. The minimum value of this field
    #     is 120 seconds. Larger values that are a multiple of a
    #     minute--for example, 240 or 300 seconds--are supported.
    #     If an invalid value is given, an
    #     error will be returned. The `Duration.nanos` field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`.
    class MetricAbsence
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that checks whether a log message in the [scoping
    # project](https://cloud.google.com/monitoring/api/v3#project_name)
    # satisfies the given filter. Logs from other projects in the metrics
    # scope are not evaluated.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A logs-based filter. See [Advanced Logs
    #     Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
    #     for how this filter should be constructed.
    # @!attribute [rw] label_extractors
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. A map from a label key to an extractor expression, which is
    #     used to extract the value for this label key. Each entry in this map is
    #     a specification for how data should be extracted from log entries that
    #     match `filter`. Each combination of extracted values is treated as a
    #     separate rule for the purposes of triggering notifications. Label keys
    #     and corresponding values can be used in notifications generated by this
    #     condition.
    #
    #     Please see [the documentation on logs-based metric
    #     `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
    #     for syntax and examples.
    class LogMatch
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelExtractorsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that allows alert policies to be defined using
    # [Monitoring Query Language](https://cloud.google.com/monitoring/mql).
    # @!attribute [rw] query
    #   @return [::String]
    #     [Monitoring Query Language](https://cloud.google.com/monitoring/mql)
    #     query that outputs a boolean stream.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving.
    class MonitoringQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that allows alert policies to be defined using
    # [Prometheus Query Language
    # (PromQL)](https://prometheus.io/docs/prometheus/latest/querying/basics/).
    #
    # The PrometheusQueryLanguageCondition message contains information
    # from a Prometheus alerting rule and its associated rule group.
    #
    # A Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/).
    # The semantics of a Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule).
    #
    # A Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
    # The semantics of a Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group).
    #
    # Because Cloud Alerting has no representation of a Prometheus rule
    # group resource, we must embed the information of the parent rule
    # group inside each of the conditions that refer to it. We must also
    # update the contents of all Prometheus alerts in case the information
    # of their rule group changes.
    #
    # The PrometheusQueryLanguageCondition protocol buffer combines the
    # information of the corresponding rule group and alerting rule.
    # The structure of the PrometheusQueryLanguageCondition protocol buffer
    # does NOT mimic the structure of the Prometheus rule group and alerting
    # rule YAML declarations. The PrometheusQueryLanguageCondition protocol
    # buffer may change in the future to support future rule group and/or
    # alerting rule features. There are no new such features at the present
    # time (2023-06-26).
    # @!attribute [rw] query
    #   @return [::String]
    #     Required. The PromQL expression to evaluate. Every evaluation cycle
    #     this expression is evaluated at the current time, and all resultant
    #     time series become pending/firing alerts. This field must not be empty.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     Optional. Alerts are considered firing once their PromQL expression was
    #     evaluated to be "true" for this long.
    #     Alerts whose PromQL expression was not evaluated to be "true" for
    #     long enough are considered pending.
    #     Must be a non-negative duration or missing.
    #     This field is optional. Its default value is zero.
    # @!attribute [rw] evaluation_interval
    #   @return [::Google::Protobuf::Duration]
    #     Optional. How often this rule should be evaluated.
    #     Must be a positive multiple of 30 seconds or missing.
    #     This field is optional. Its default value is 30 seconds.
    #     If this PrometheusQueryLanguageCondition was generated from a
    #     Prometheus alerting rule, then this value should be taken from the
    #     enclosing rule group.
    # @!attribute [rw] labels
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. Labels to add to or overwrite in the PromQL query result.
    #     Label names [must be
    #     valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     Label values can be [templatized by using
    #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
    #     The only available variable names are the names of the labels in the
    #     PromQL result, including "__name__" and "value". "labels" may be empty.
    # @!attribute [rw] rule_group
    #   @return [::String]
    #     Optional. The rule group name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must
    #     contain a valid UTF-8 string.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] alert_rule
    #   @return [::String]
    #     Optional. The alerting rule name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must be a
    #     [valid Prometheus label
    #     name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     This field may not exceed 2048 Unicode characters in length.
    class PrometheusQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition control that determines how metric-threshold conditions
    # are evaluated when data stops arriving.
    # This control doesn't affect metric-absence policies.
    module EvaluationMissingData
      # An unspecified evaluation missing data option.  Equivalent to
      # EVALUATION_MISSING_DATA_NO_OP.
      EVALUATION_MISSING_DATA_UNSPECIFIED = 0

      # If there is no data to evaluate the condition, then evaluate the
      # condition as false.
      EVALUATION_MISSING_DATA_INACTIVE = 1

      # If there is no data to evaluate the condition, then evaluate the
      # condition as true.
      EVALUATION_MISSING_DATA_ACTIVE = 2

      # Do not evaluate the condition to any value if there is no data.
      EVALUATION_MISSING_DATA_NO_OP = 3
    end
  end

  # Control over how the notification channels in `notification_channels`
  # are notified when this alert fires.
  # @!attribute [rw] notification_rate_limit
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationRateLimit]
  #     Required for alert policies with a `LogMatch` condition.
  #
  #     This limit is not implemented for alert policies that are not log-based.
  # @!attribute [rw] auto_close
  #   @return [::Google::Protobuf::Duration]
  #     If an alert policy that was active has no data for this long, any open
  #     incidents will close
  # @!attribute [rw] notification_channel_strategy
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationChannelStrategy>]
  #     Control how notifications will be sent out, on a per-channel basis.
  class AlertStrategy
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Control over the rate of notifications sent to this alert policy's
    # notification channels.
    # @!attribute [rw] period
    #   @return [::Google::Protobuf::Duration]
    #     Not more than one notification per `period`.
    class NotificationRateLimit
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Control over how the notification channels in `notification_channels`
    # are notified when this alert fires, on a per-channel basis.
    # @!attribute [rw] notification_channel_names
    #   @return [::Array<::String>]
    #     The full REST resource name for the notification channels that these
    #     settings apply to. Each of these correspond to the name field in one
    #     of the NotificationChannel objects referenced in the
    #     notification_channels field of this AlertPolicy.
    #     The format is:
    #
    #         projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
    # @!attribute [rw] renotify_interval
    #   @return [::Google::Protobuf::Duration]
    #     The frequency at which to send reminder notifications for open
    #     incidents.
    class NotificationChannelStrategy
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class UserLabelsEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical `AND` operator. An
    # incident is created only if all the conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical `OR` operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical `AND` operator, but unlike the regular
    # `AND` option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end

  # An enumeration of possible severity level for an Alert Policy.
  module Severity
    # No severity is specified. This is the default value.
    SEVERITY_UNSPECIFIED = 0

    # This is the highest severity level. Use this if the problem could
    # cause significant damage or downtime.
    CRITICAL = 1

    # This is the medium severity level. Use this if the problem could
    # cause minor damage or downtime.
    ERROR = 2

    # This is the lowest severity level. Use this if the problem is not causing
    # any damage or downtime, but could potentially lead to a problem in the
    # future.
    WARNING = 3
  end
end

#severity::Google::Cloud::Monitoring::V3::AlertPolicy::Severity

Returns Optional. The severity of an alert policy indicates how important incidents generated by that policy are. The severity level will be displayed on the Incident detail page and in notifications.

Returns:



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# File 'proto_docs/google/monitoring/v3/alert.rb', line 131

class AlertPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Documentation that is included in the notifications and incidents
  # pertaining to this policy.
  # @!attribute [rw] content
  #   @return [::String]
  #     The body of the documentation, interpreted according to `mime_type`.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller. This text can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  # @!attribute [rw] mime_type
  #   @return [::String]
  #     The format of the `content` field. Presently, only the value
  #     `"text/markdown"` is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  # @!attribute [rw] subject
  #   @return [::String]
  #     Optional. The subject line of the notification. The subject line may not
  #     exceed 10,240 bytes. In notifications generated by this policy, the
  #     contents of the subject line after variable expansion will be truncated
  #     to 255 bytes or shorter at the latest UTF-8 character boundary. The
  #     255-byte limit is recommended by [this
  #     thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit).
  #     It is both the limit imposed by some third-party ticketing products and
  #     it is common to define textual fields in databases as VARCHAR(255).
  #
  #     The contents of the subject line can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  #     If this field is missing or empty, a default subject line will be
  #     generated.
  # @!attribute [rw] links
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::Documentation::Link>]
  #     Optional. Links to content such as playbooks, repositories, and other
  #     resources. This field can contain up to 3 entries.
  class Documentation
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Links to content such as playbooks, repositories, and other resources.
    # @!attribute [rw] display_name
    #   @return [::String]
    #     A short display name for the link. The display name must not be empty
    #     or exceed 63 characters. Example: "playbook".
    # @!attribute [rw] url
    #   @return [::String]
    #     The url of a webpage.
    #     A url can be templatized by using variables
    #     in the path or the query parameters. The total length of a URL should
    #     not exceed 2083 characters before and after variable expansion.
    #     Example: "https://my_domain.com/playbook?name=$\\{resource.name}"
    class Link
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [::String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its format is:
  #
  #         projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     `[CONDITION_ID]` is assigned by Cloud Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#create_alert_policy alertPolicies.create}
  #     method, do not include the `name` field in the conditions of the
  #     requested alerting policy. Cloud Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#update_alert_policy alertPolicies.update}
  #     method to update a policy, including a condition `name` causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve `[CONDITION_ID]` if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [::String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  # @!attribute [rw] condition_matched_log
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::LogMatch]
  #     A condition that checks for log messages matching given constraints. If
  #     set, no other conditions can be present.
  # @!attribute [rw] condition_monitoring_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MonitoringQueryLanguageCondition]
  #     A condition that uses the Monitoring Query Language to define
  #     alerts.
  # @!attribute [rw] condition_prometheus_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition]
  #     A condition that uses the Prometheus query language to define alerts.
  class Condition
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a `{count: 1}` trigger is used.
    # @!attribute [rw] count
    #   @return [::Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [::Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] denominator_filter
    #   @return [::String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies a time series that should be used as the denominator of a
    #     ratio that will be compared with the threshold. If a
    #     `denominator_filter` is specified, the time series specified by the
    #     `filter` field will be used as the numerator.
    #
    #     The filter must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by `denominatorFilter` as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the `aggregations` and
    #     `denominator_aggregations` fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    # @!attribute [rw] forecast_options
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold::ForecastOptions]
    #     When this field is present, the `MetricThreshold` condition forecasts
    #     whether the time series is predicted to violate the threshold within
    #     the `forecast_horizon`. When this field is not set, the
    #     `MetricThreshold` tests the current value of the timeseries against the
    #     threshold.
    # @!attribute [rw] comparison
    #   @return [::Google::Cloud::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by `filter`
    #     and `aggregation`) and the threshold (indicated by `threshold_value`).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [::Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving. To use this control, the value
    #     of the `duration` field must be greater than or equal to 60 seconds.
    class MetricThreshold
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Options used when forecasting the time series and testing
      # the predicted value against the threshold.
      # @!attribute [rw] forecast_horizon
      #   @return [::Google::Protobuf::Duration]
      #     Required. The length of time into the future to forecast whether a
      #     time series will violate the threshold. If the predicted value is
      #     found to violate the threshold, and the violation is observed in all
      #     forecasts made for the configured `duration`, then the time series is
      #     considered to be failing.
      #     The forecast horizon can range from 1 hour to 60 hours.
      class ForecastOptions
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified `duration`.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. The minimum value of this field
    #     is 120 seconds. Larger values that are a multiple of a
    #     minute--for example, 240 or 300 seconds--are supported.
    #     If an invalid value is given, an
    #     error will be returned. The `Duration.nanos` field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`.
    class MetricAbsence
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that checks whether a log message in the [scoping
    # project](https://cloud.google.com/monitoring/api/v3#project_name)
    # satisfies the given filter. Logs from other projects in the metrics
    # scope are not evaluated.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A logs-based filter. See [Advanced Logs
    #     Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
    #     for how this filter should be constructed.
    # @!attribute [rw] label_extractors
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. A map from a label key to an extractor expression, which is
    #     used to extract the value for this label key. Each entry in this map is
    #     a specification for how data should be extracted from log entries that
    #     match `filter`. Each combination of extracted values is treated as a
    #     separate rule for the purposes of triggering notifications. Label keys
    #     and corresponding values can be used in notifications generated by this
    #     condition.
    #
    #     Please see [the documentation on logs-based metric
    #     `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
    #     for syntax and examples.
    class LogMatch
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelExtractorsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that allows alert policies to be defined using
    # [Monitoring Query Language](https://cloud.google.com/monitoring/mql).
    # @!attribute [rw] query
    #   @return [::String]
    #     [Monitoring Query Language](https://cloud.google.com/monitoring/mql)
    #     query that outputs a boolean stream.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving.
    class MonitoringQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that allows alert policies to be defined using
    # [Prometheus Query Language
    # (PromQL)](https://prometheus.io/docs/prometheus/latest/querying/basics/).
    #
    # The PrometheusQueryLanguageCondition message contains information
    # from a Prometheus alerting rule and its associated rule group.
    #
    # A Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/).
    # The semantics of a Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule).
    #
    # A Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
    # The semantics of a Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group).
    #
    # Because Cloud Alerting has no representation of a Prometheus rule
    # group resource, we must embed the information of the parent rule
    # group inside each of the conditions that refer to it. We must also
    # update the contents of all Prometheus alerts in case the information
    # of their rule group changes.
    #
    # The PrometheusQueryLanguageCondition protocol buffer combines the
    # information of the corresponding rule group and alerting rule.
    # The structure of the PrometheusQueryLanguageCondition protocol buffer
    # does NOT mimic the structure of the Prometheus rule group and alerting
    # rule YAML declarations. The PrometheusQueryLanguageCondition protocol
    # buffer may change in the future to support future rule group and/or
    # alerting rule features. There are no new such features at the present
    # time (2023-06-26).
    # @!attribute [rw] query
    #   @return [::String]
    #     Required. The PromQL expression to evaluate. Every evaluation cycle
    #     this expression is evaluated at the current time, and all resultant
    #     time series become pending/firing alerts. This field must not be empty.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     Optional. Alerts are considered firing once their PromQL expression was
    #     evaluated to be "true" for this long.
    #     Alerts whose PromQL expression was not evaluated to be "true" for
    #     long enough are considered pending.
    #     Must be a non-negative duration or missing.
    #     This field is optional. Its default value is zero.
    # @!attribute [rw] evaluation_interval
    #   @return [::Google::Protobuf::Duration]
    #     Optional. How often this rule should be evaluated.
    #     Must be a positive multiple of 30 seconds or missing.
    #     This field is optional. Its default value is 30 seconds.
    #     If this PrometheusQueryLanguageCondition was generated from a
    #     Prometheus alerting rule, then this value should be taken from the
    #     enclosing rule group.
    # @!attribute [rw] labels
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. Labels to add to or overwrite in the PromQL query result.
    #     Label names [must be
    #     valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     Label values can be [templatized by using
    #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
    #     The only available variable names are the names of the labels in the
    #     PromQL result, including "__name__" and "value". "labels" may be empty.
    # @!attribute [rw] rule_group
    #   @return [::String]
    #     Optional. The rule group name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must
    #     contain a valid UTF-8 string.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] alert_rule
    #   @return [::String]
    #     Optional. The alerting rule name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must be a
    #     [valid Prometheus label
    #     name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     This field may not exceed 2048 Unicode characters in length.
    class PrometheusQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition control that determines how metric-threshold conditions
    # are evaluated when data stops arriving.
    # This control doesn't affect metric-absence policies.
    module EvaluationMissingData
      # An unspecified evaluation missing data option.  Equivalent to
      # EVALUATION_MISSING_DATA_NO_OP.
      EVALUATION_MISSING_DATA_UNSPECIFIED = 0

      # If there is no data to evaluate the condition, then evaluate the
      # condition as false.
      EVALUATION_MISSING_DATA_INACTIVE = 1

      # If there is no data to evaluate the condition, then evaluate the
      # condition as true.
      EVALUATION_MISSING_DATA_ACTIVE = 2

      # Do not evaluate the condition to any value if there is no data.
      EVALUATION_MISSING_DATA_NO_OP = 3
    end
  end

  # Control over how the notification channels in `notification_channels`
  # are notified when this alert fires.
  # @!attribute [rw] notification_rate_limit
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationRateLimit]
  #     Required for alert policies with a `LogMatch` condition.
  #
  #     This limit is not implemented for alert policies that are not log-based.
  # @!attribute [rw] auto_close
  #   @return [::Google::Protobuf::Duration]
  #     If an alert policy that was active has no data for this long, any open
  #     incidents will close
  # @!attribute [rw] notification_channel_strategy
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationChannelStrategy>]
  #     Control how notifications will be sent out, on a per-channel basis.
  class AlertStrategy
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Control over the rate of notifications sent to this alert policy's
    # notification channels.
    # @!attribute [rw] period
    #   @return [::Google::Protobuf::Duration]
    #     Not more than one notification per `period`.
    class NotificationRateLimit
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Control over how the notification channels in `notification_channels`
    # are notified when this alert fires, on a per-channel basis.
    # @!attribute [rw] notification_channel_names
    #   @return [::Array<::String>]
    #     The full REST resource name for the notification channels that these
    #     settings apply to. Each of these correspond to the name field in one
    #     of the NotificationChannel objects referenced in the
    #     notification_channels field of this AlertPolicy.
    #     The format is:
    #
    #         projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
    # @!attribute [rw] renotify_interval
    #   @return [::Google::Protobuf::Duration]
    #     The frequency at which to send reminder notifications for open
    #     incidents.
    class NotificationChannelStrategy
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class UserLabelsEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical `AND` operator. An
    # incident is created only if all the conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical `OR` operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical `AND` operator, but unlike the regular
    # `AND` option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end

  # An enumeration of possible severity level for an Alert Policy.
  module Severity
    # No severity is specified. This is the default value.
    SEVERITY_UNSPECIFIED = 0

    # This is the highest severity level. Use this if the problem could
    # cause significant damage or downtime.
    CRITICAL = 1

    # This is the medium severity level. Use this if the problem could
    # cause minor damage or downtime.
    ERROR = 2

    # This is the lowest severity level. Use this if the problem is not causing
    # any damage or downtime, but could potentially lead to a problem in the
    # future.
    WARNING = 3
  end
end

#user_labels::Google::Protobuf::Map{::String => ::String}

Returns User-supplied key/value data to be used for organizing and identifying the AlertPolicy objects.

The field can contain up to 64 entries. Each key and value is limited to 63 Unicode characters or 128 bytes, whichever is smaller. Labels and values can contain only lowercase letters, numerals, underscores, and dashes. Keys must begin with a letter.

Note that Prometheus {alert name} is a valid Prometheus label names, whereas Prometheus {rule group} is an unrestricted UTF-8 string. This means that they cannot be stored as-is in user labels, because they may contain characters that are not allowed in user-label values.

Returns:

  • (::Google::Protobuf::Map{::String => ::String})

    User-supplied key/value data to be used for organizing and identifying the AlertPolicy objects.

    The field can contain up to 64 entries. Each key and value is limited to 63 Unicode characters or 128 bytes, whichever is smaller. Labels and values can contain only lowercase letters, numerals, underscores, and dashes. Keys must begin with a letter.

    Note that Prometheus {alert name} is a valid Prometheus label names, whereas Prometheus {rule group} is an unrestricted UTF-8 string. This means that they cannot be stored as-is in user labels, because they may contain characters that are not allowed in user-label values.



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# File 'proto_docs/google/monitoring/v3/alert.rb', line 131

class AlertPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Documentation that is included in the notifications and incidents
  # pertaining to this policy.
  # @!attribute [rw] content
  #   @return [::String]
  #     The body of the documentation, interpreted according to `mime_type`.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller. This text can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  # @!attribute [rw] mime_type
  #   @return [::String]
  #     The format of the `content` field. Presently, only the value
  #     `"text/markdown"` is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  # @!attribute [rw] subject
  #   @return [::String]
  #     Optional. The subject line of the notification. The subject line may not
  #     exceed 10,240 bytes. In notifications generated by this policy, the
  #     contents of the subject line after variable expansion will be truncated
  #     to 255 bytes or shorter at the latest UTF-8 character boundary. The
  #     255-byte limit is recommended by [this
  #     thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit).
  #     It is both the limit imposed by some third-party ticketing products and
  #     it is common to define textual fields in databases as VARCHAR(255).
  #
  #     The contents of the subject line can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  #     If this field is missing or empty, a default subject line will be
  #     generated.
  # @!attribute [rw] links
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::Documentation::Link>]
  #     Optional. Links to content such as playbooks, repositories, and other
  #     resources. This field can contain up to 3 entries.
  class Documentation
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Links to content such as playbooks, repositories, and other resources.
    # @!attribute [rw] display_name
    #   @return [::String]
    #     A short display name for the link. The display name must not be empty
    #     or exceed 63 characters. Example: "playbook".
    # @!attribute [rw] url
    #   @return [::String]
    #     The url of a webpage.
    #     A url can be templatized by using variables
    #     in the path or the query parameters. The total length of a URL should
    #     not exceed 2083 characters before and after variable expansion.
    #     Example: "https://my_domain.com/playbook?name=$\\{resource.name}"
    class Link
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [::String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its format is:
  #
  #         projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     `[CONDITION_ID]` is assigned by Cloud Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#create_alert_policy alertPolicies.create}
  #     method, do not include the `name` field in the conditions of the
  #     requested alerting policy. Cloud Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#update_alert_policy alertPolicies.update}
  #     method to update a policy, including a condition `name` causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve `[CONDITION_ID]` if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [::String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  # @!attribute [rw] condition_matched_log
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::LogMatch]
  #     A condition that checks for log messages matching given constraints. If
  #     set, no other conditions can be present.
  # @!attribute [rw] condition_monitoring_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MonitoringQueryLanguageCondition]
  #     A condition that uses the Monitoring Query Language to define
  #     alerts.
  # @!attribute [rw] condition_prometheus_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition]
  #     A condition that uses the Prometheus query language to define alerts.
  class Condition
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a `{count: 1}` trigger is used.
    # @!attribute [rw] count
    #   @return [::Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [::Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] denominator_filter
    #   @return [::String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies a time series that should be used as the denominator of a
    #     ratio that will be compared with the threshold. If a
    #     `denominator_filter` is specified, the time series specified by the
    #     `filter` field will be used as the numerator.
    #
    #     The filter must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by `denominatorFilter` as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the `aggregations` and
    #     `denominator_aggregations` fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    # @!attribute [rw] forecast_options
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold::ForecastOptions]
    #     When this field is present, the `MetricThreshold` condition forecasts
    #     whether the time series is predicted to violate the threshold within
    #     the `forecast_horizon`. When this field is not set, the
    #     `MetricThreshold` tests the current value of the timeseries against the
    #     threshold.
    # @!attribute [rw] comparison
    #   @return [::Google::Cloud::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by `filter`
    #     and `aggregation`) and the threshold (indicated by `threshold_value`).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [::Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving. To use this control, the value
    #     of the `duration` field must be greater than or equal to 60 seconds.
    class MetricThreshold
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Options used when forecasting the time series and testing
      # the predicted value against the threshold.
      # @!attribute [rw] forecast_horizon
      #   @return [::Google::Protobuf::Duration]
      #     Required. The length of time into the future to forecast whether a
      #     time series will violate the threshold. If the predicted value is
      #     found to violate the threshold, and the violation is observed in all
      #     forecasts made for the configured `duration`, then the time series is
      #     considered to be failing.
      #     The forecast horizon can range from 1 hour to 60 hours.
      class ForecastOptions
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified `duration`.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. The minimum value of this field
    #     is 120 seconds. Larger values that are a multiple of a
    #     minute--for example, 240 or 300 seconds--are supported.
    #     If an invalid value is given, an
    #     error will be returned. The `Duration.nanos` field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`.
    class MetricAbsence
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that checks whether a log message in the [scoping
    # project](https://cloud.google.com/monitoring/api/v3#project_name)
    # satisfies the given filter. Logs from other projects in the metrics
    # scope are not evaluated.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A logs-based filter. See [Advanced Logs
    #     Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
    #     for how this filter should be constructed.
    # @!attribute [rw] label_extractors
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. A map from a label key to an extractor expression, which is
    #     used to extract the value for this label key. Each entry in this map is
    #     a specification for how data should be extracted from log entries that
    #     match `filter`. Each combination of extracted values is treated as a
    #     separate rule for the purposes of triggering notifications. Label keys
    #     and corresponding values can be used in notifications generated by this
    #     condition.
    #
    #     Please see [the documentation on logs-based metric
    #     `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
    #     for syntax and examples.
    class LogMatch
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelExtractorsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that allows alert policies to be defined using
    # [Monitoring Query Language](https://cloud.google.com/monitoring/mql).
    # @!attribute [rw] query
    #   @return [::String]
    #     [Monitoring Query Language](https://cloud.google.com/monitoring/mql)
    #     query that outputs a boolean stream.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving.
    class MonitoringQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that allows alert policies to be defined using
    # [Prometheus Query Language
    # (PromQL)](https://prometheus.io/docs/prometheus/latest/querying/basics/).
    #
    # The PrometheusQueryLanguageCondition message contains information
    # from a Prometheus alerting rule and its associated rule group.
    #
    # A Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/).
    # The semantics of a Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule).
    #
    # A Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
    # The semantics of a Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group).
    #
    # Because Cloud Alerting has no representation of a Prometheus rule
    # group resource, we must embed the information of the parent rule
    # group inside each of the conditions that refer to it. We must also
    # update the contents of all Prometheus alerts in case the information
    # of their rule group changes.
    #
    # The PrometheusQueryLanguageCondition protocol buffer combines the
    # information of the corresponding rule group and alerting rule.
    # The structure of the PrometheusQueryLanguageCondition protocol buffer
    # does NOT mimic the structure of the Prometheus rule group and alerting
    # rule YAML declarations. The PrometheusQueryLanguageCondition protocol
    # buffer may change in the future to support future rule group and/or
    # alerting rule features. There are no new such features at the present
    # time (2023-06-26).
    # @!attribute [rw] query
    #   @return [::String]
    #     Required. The PromQL expression to evaluate. Every evaluation cycle
    #     this expression is evaluated at the current time, and all resultant
    #     time series become pending/firing alerts. This field must not be empty.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     Optional. Alerts are considered firing once their PromQL expression was
    #     evaluated to be "true" for this long.
    #     Alerts whose PromQL expression was not evaluated to be "true" for
    #     long enough are considered pending.
    #     Must be a non-negative duration or missing.
    #     This field is optional. Its default value is zero.
    # @!attribute [rw] evaluation_interval
    #   @return [::Google::Protobuf::Duration]
    #     Optional. How often this rule should be evaluated.
    #     Must be a positive multiple of 30 seconds or missing.
    #     This field is optional. Its default value is 30 seconds.
    #     If this PrometheusQueryLanguageCondition was generated from a
    #     Prometheus alerting rule, then this value should be taken from the
    #     enclosing rule group.
    # @!attribute [rw] labels
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. Labels to add to or overwrite in the PromQL query result.
    #     Label names [must be
    #     valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     Label values can be [templatized by using
    #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
    #     The only available variable names are the names of the labels in the
    #     PromQL result, including "__name__" and "value". "labels" may be empty.
    # @!attribute [rw] rule_group
    #   @return [::String]
    #     Optional. The rule group name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must
    #     contain a valid UTF-8 string.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] alert_rule
    #   @return [::String]
    #     Optional. The alerting rule name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must be a
    #     [valid Prometheus label
    #     name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     This field may not exceed 2048 Unicode characters in length.
    class PrometheusQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition control that determines how metric-threshold conditions
    # are evaluated when data stops arriving.
    # This control doesn't affect metric-absence policies.
    module EvaluationMissingData
      # An unspecified evaluation missing data option.  Equivalent to
      # EVALUATION_MISSING_DATA_NO_OP.
      EVALUATION_MISSING_DATA_UNSPECIFIED = 0

      # If there is no data to evaluate the condition, then evaluate the
      # condition as false.
      EVALUATION_MISSING_DATA_INACTIVE = 1

      # If there is no data to evaluate the condition, then evaluate the
      # condition as true.
      EVALUATION_MISSING_DATA_ACTIVE = 2

      # Do not evaluate the condition to any value if there is no data.
      EVALUATION_MISSING_DATA_NO_OP = 3
    end
  end

  # Control over how the notification channels in `notification_channels`
  # are notified when this alert fires.
  # @!attribute [rw] notification_rate_limit
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationRateLimit]
  #     Required for alert policies with a `LogMatch` condition.
  #
  #     This limit is not implemented for alert policies that are not log-based.
  # @!attribute [rw] auto_close
  #   @return [::Google::Protobuf::Duration]
  #     If an alert policy that was active has no data for this long, any open
  #     incidents will close
  # @!attribute [rw] notification_channel_strategy
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationChannelStrategy>]
  #     Control how notifications will be sent out, on a per-channel basis.
  class AlertStrategy
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Control over the rate of notifications sent to this alert policy's
    # notification channels.
    # @!attribute [rw] period
    #   @return [::Google::Protobuf::Duration]
    #     Not more than one notification per `period`.
    class NotificationRateLimit
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Control over how the notification channels in `notification_channels`
    # are notified when this alert fires, on a per-channel basis.
    # @!attribute [rw] notification_channel_names
    #   @return [::Array<::String>]
    #     The full REST resource name for the notification channels that these
    #     settings apply to. Each of these correspond to the name field in one
    #     of the NotificationChannel objects referenced in the
    #     notification_channels field of this AlertPolicy.
    #     The format is:
    #
    #         projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
    # @!attribute [rw] renotify_interval
    #   @return [::Google::Protobuf::Duration]
    #     The frequency at which to send reminder notifications for open
    #     incidents.
    class NotificationChannelStrategy
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class UserLabelsEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical `AND` operator. An
    # incident is created only if all the conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical `OR` operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical `AND` operator, but unlike the regular
    # `AND` option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end

  # An enumeration of possible severity level for an Alert Policy.
  module Severity
    # No severity is specified. This is the default value.
    SEVERITY_UNSPECIFIED = 0

    # This is the highest severity level. Use this if the problem could
    # cause significant damage or downtime.
    CRITICAL = 1

    # This is the medium severity level. Use this if the problem could
    # cause minor damage or downtime.
    ERROR = 2

    # This is the lowest severity level. Use this if the problem is not causing
    # any damage or downtime, but could potentially lead to a problem in the
    # future.
    WARNING = 3
  end
end

#validity::Google::Rpc::Status

Returns Read-only description of how the alert policy is invalid. This field is only set when the alert policy is invalid. An invalid alert policy will not generate incidents.

Returns:

  • (::Google::Rpc::Status)

    Read-only description of how the alert policy is invalid. This field is only set when the alert policy is invalid. An invalid alert policy will not generate incidents.



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# File 'proto_docs/google/monitoring/v3/alert.rb', line 131

class AlertPolicy
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Documentation that is included in the notifications and incidents
  # pertaining to this policy.
  # @!attribute [rw] content
  #   @return [::String]
  #     The body of the documentation, interpreted according to `mime_type`.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller. This text can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  # @!attribute [rw] mime_type
  #   @return [::String]
  #     The format of the `content` field. Presently, only the value
  #     `"text/markdown"` is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  # @!attribute [rw] subject
  #   @return [::String]
  #     Optional. The subject line of the notification. The subject line may not
  #     exceed 10,240 bytes. In notifications generated by this policy, the
  #     contents of the subject line after variable expansion will be truncated
  #     to 255 bytes or shorter at the latest UTF-8 character boundary. The
  #     255-byte limit is recommended by [this
  #     thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit).
  #     It is both the limit imposed by some third-party ticketing products and
  #     it is common to define textual fields in databases as VARCHAR(255).
  #
  #     The contents of the subject line can be [templatized by using
  #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
  #     If this field is missing or empty, a default subject line will be
  #     generated.
  # @!attribute [rw] links
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::Documentation::Link>]
  #     Optional. Links to content such as playbooks, repositories, and other
  #     resources. This field can contain up to 3 entries.
  class Documentation
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Links to content such as playbooks, repositories, and other resources.
    # @!attribute [rw] display_name
    #   @return [::String]
    #     A short display name for the link. The display name must not be empty
    #     or exceed 63 characters. Example: "playbook".
    # @!attribute [rw] url
    #   @return [::String]
    #     The url of a webpage.
    #     A url can be templatized by using variables
    #     in the path or the query parameters. The total length of a URL should
    #     not exceed 2083 characters before and after variable expansion.
    #     Example: "https://my_domain.com/playbook?name=$\\{resource.name}"
    class Link
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [::String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its format is:
  #
  #         projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     `[CONDITION_ID]` is assigned by Cloud Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#create_alert_policy alertPolicies.create}
  #     method, do not include the `name` field in the conditions of the
  #     requested alerting policy. Cloud Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#update_alert_policy alertPolicies.update}
  #     method to update a policy, including a condition `name` causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve `[CONDITION_ID]` if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [::String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  # @!attribute [rw] condition_matched_log
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::LogMatch]
  #     A condition that checks for log messages matching given constraints. If
  #     set, no other conditions can be present.
  # @!attribute [rw] condition_monitoring_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MonitoringQueryLanguageCondition]
  #     A condition that uses the Monitoring Query Language to define
  #     alerts.
  # @!attribute [rw] condition_prometheus_query_language
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition]
  #     A condition that uses the Prometheus query language to define alerts.
  class Condition
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a `{count: 1}` trigger is used.
    # @!attribute [rw] count
    #   @return [::Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [::Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] denominator_filter
    #   @return [::String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies a time series that should be used as the denominator of a
    #     ratio that will be compared with the threshold. If a
    #     `denominator_filter` is specified, the time series specified by the
    #     `filter` field will be used as the numerator.
    #
    #     The filter must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by `denominatorFilter` as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the `aggregations` and
    #     `denominator_aggregations` fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    # @!attribute [rw] forecast_options
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::MetricThreshold::ForecastOptions]
    #     When this field is present, the `MetricThreshold` condition forecasts
    #     whether the time series is predicted to violate the threshold within
    #     the `forecast_horizon`. When this field is not set, the
    #     `MetricThreshold` tests the current value of the timeseries against the
    #     threshold.
    # @!attribute [rw] comparison
    #   @return [::Google::Cloud::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by `filter`
    #     and `aggregation`) and the threshold (indicated by `threshold_value`).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [::Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving. To use this control, the value
    #     of the `duration` field must be greater than or equal to 60 seconds.
    class MetricThreshold
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Options used when forecasting the time series and testing
      # the predicted value against the threshold.
      # @!attribute [rw] forecast_horizon
      #   @return [::Google::Protobuf::Duration]
      #     Required. The length of time into the future to forecast whether a
      #     time series will violate the threshold. If the predicted value is
      #     found to violate the threshold, and the violation is observed in all
      #     forecasts made for the configured `duration`, then the time series is
      #     considered to be failing.
      #     The forecast horizon can range from 1 hour to 60 hours.
      class ForecastOptions
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified `duration`.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A
    #     [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
    #     (that call is useful to verify the time series that will be retrieved /
    #     processed). The filter must specify the metric type and the resource
    #     type. Optionally, it can specify resource labels and metric labels.
    #     This field must not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [::Array<::Google::Cloud::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the [`ListTimeSeries`
    #     request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the `ListTimeSeries` method when debugging this
    #     field.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. The minimum value of this field
    #     is 120 seconds. Larger values that are a multiple of a
    #     minute--for example, 240 or 300 seconds--are supported.
    #     If an invalid value is given, an
    #     error will be returned. The `Duration.nanos` field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`.
    class MetricAbsence
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that checks whether a log message in the [scoping
    # project](https://cloud.google.com/monitoring/api/v3#project_name)
    # satisfies the given filter. Logs from other projects in the metrics
    # scope are not evaluated.
    # @!attribute [rw] filter
    #   @return [::String]
    #     Required. A logs-based filter. See [Advanced Logs
    #     Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
    #     for how this filter should be constructed.
    # @!attribute [rw] label_extractors
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. A map from a label key to an extractor expression, which is
    #     used to extract the value for this label key. Each entry in this map is
    #     a specification for how data should be extracted from log entries that
    #     match `filter`. Each combination of extracted values is treated as a
    #     separate rule for the purposes of triggering notifications. Label keys
    #     and corresponding values can be used in notifications generated by this
    #     condition.
    #
    #     Please see [the documentation on logs-based metric
    #     `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
    #     for syntax and examples.
    class LogMatch
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelExtractorsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition type that allows alert policies to be defined using
    # [Monitoring Query Language](https://cloud.google.com/monitoring/mql).
    # @!attribute [rw] query
    #   @return [::String]
    #     [Monitoring Query Language](https://cloud.google.com/monitoring/mql)
    #     query that outputs a boolean stream.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g., 0, 60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. When choosing a duration, it is useful to
    #     keep in mind the frequency of the underlying time series data
    #     (which may also be affected by any alignments specified in the
    #     `aggregations` field); a good duration is long enough so that a single
    #     outlier does not generate spurious alerts, but short enough that
    #     unhealthy states are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by `filter` and `aggregations`,
    #     or by the ratio, if `denominator_filter` and `denominator_aggregations`
    #     are specified.
    # @!attribute [rw] evaluation_missing_data
    #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::Condition::EvaluationMissingData]
    #     A condition control that determines how metric-threshold conditions
    #     are evaluated when data stops arriving.
    class MonitoringQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # A condition type that allows alert policies to be defined using
    # [Prometheus Query Language
    # (PromQL)](https://prometheus.io/docs/prometheus/latest/querying/basics/).
    #
    # The PrometheusQueryLanguageCondition message contains information
    # from a Prometheus alerting rule and its associated rule group.
    #
    # A Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/).
    # The semantics of a Prometheus alerting rule is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule).
    #
    # A Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
    # The semantics of a Prometheus rule group is described
    # [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group).
    #
    # Because Cloud Alerting has no representation of a Prometheus rule
    # group resource, we must embed the information of the parent rule
    # group inside each of the conditions that refer to it. We must also
    # update the contents of all Prometheus alerts in case the information
    # of their rule group changes.
    #
    # The PrometheusQueryLanguageCondition protocol buffer combines the
    # information of the corresponding rule group and alerting rule.
    # The structure of the PrometheusQueryLanguageCondition protocol buffer
    # does NOT mimic the structure of the Prometheus rule group and alerting
    # rule YAML declarations. The PrometheusQueryLanguageCondition protocol
    # buffer may change in the future to support future rule group and/or
    # alerting rule features. There are no new such features at the present
    # time (2023-06-26).
    # @!attribute [rw] query
    #   @return [::String]
    #     Required. The PromQL expression to evaluate. Every evaluation cycle
    #     this expression is evaluated at the current time, and all resultant
    #     time series become pending/firing alerts. This field must not be empty.
    # @!attribute [rw] duration
    #   @return [::Google::Protobuf::Duration]
    #     Optional. Alerts are considered firing once their PromQL expression was
    #     evaluated to be "true" for this long.
    #     Alerts whose PromQL expression was not evaluated to be "true" for
    #     long enough are considered pending.
    #     Must be a non-negative duration or missing.
    #     This field is optional. Its default value is zero.
    # @!attribute [rw] evaluation_interval
    #   @return [::Google::Protobuf::Duration]
    #     Optional. How often this rule should be evaluated.
    #     Must be a positive multiple of 30 seconds or missing.
    #     This field is optional. Its default value is 30 seconds.
    #     If this PrometheusQueryLanguageCondition was generated from a
    #     Prometheus alerting rule, then this value should be taken from the
    #     enclosing rule group.
    # @!attribute [rw] labels
    #   @return [::Google::Protobuf::Map{::String => ::String}]
    #     Optional. Labels to add to or overwrite in the PromQL query result.
    #     Label names [must be
    #     valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     Label values can be [templatized by using
    #     variables](https://cloud.google.com/monitoring/alerts/doc-variables).
    #     The only available variable names are the names of the labels in the
    #     PromQL result, including "__name__" and "value". "labels" may be empty.
    # @!attribute [rw] rule_group
    #   @return [::String]
    #     Optional. The rule group name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must
    #     contain a valid UTF-8 string.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] alert_rule
    #   @return [::String]
    #     Optional. The alerting rule name of this alert in the corresponding
    #     Prometheus configuration file.
    #
    #     Some external tools may require this field to be populated correctly
    #     in order to refer to the original Prometheus configuration file.
    #     The rule group name and the alert name are necessary to update the
    #     relevant AlertPolicies in case the definition of the rule group changes
    #     in the future.
    #
    #     This field is optional. If this field is not empty, then it must be a
    #     [valid Prometheus label
    #     name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
    #     This field may not exceed 2048 Unicode characters in length.
    class PrometheusQueryLanguageCondition
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # @!attribute [rw] key
      #   @return [::String]
      # @!attribute [rw] value
      #   @return [::String]
      class LabelsEntry
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # A condition control that determines how metric-threshold conditions
    # are evaluated when data stops arriving.
    # This control doesn't affect metric-absence policies.
    module EvaluationMissingData
      # An unspecified evaluation missing data option.  Equivalent to
      # EVALUATION_MISSING_DATA_NO_OP.
      EVALUATION_MISSING_DATA_UNSPECIFIED = 0

      # If there is no data to evaluate the condition, then evaluate the
      # condition as false.
      EVALUATION_MISSING_DATA_INACTIVE = 1

      # If there is no data to evaluate the condition, then evaluate the
      # condition as true.
      EVALUATION_MISSING_DATA_ACTIVE = 2

      # Do not evaluate the condition to any value if there is no data.
      EVALUATION_MISSING_DATA_NO_OP = 3
    end
  end

  # Control over how the notification channels in `notification_channels`
  # are notified when this alert fires.
  # @!attribute [rw] notification_rate_limit
  #   @return [::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationRateLimit]
  #     Required for alert policies with a `LogMatch` condition.
  #
  #     This limit is not implemented for alert policies that are not log-based.
  # @!attribute [rw] auto_close
  #   @return [::Google::Protobuf::Duration]
  #     If an alert policy that was active has no data for this long, any open
  #     incidents will close
  # @!attribute [rw] notification_channel_strategy
  #   @return [::Array<::Google::Cloud::Monitoring::V3::AlertPolicy::AlertStrategy::NotificationChannelStrategy>]
  #     Control how notifications will be sent out, on a per-channel basis.
  class AlertStrategy
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Control over the rate of notifications sent to this alert policy's
    # notification channels.
    # @!attribute [rw] period
    #   @return [::Google::Protobuf::Duration]
    #     Not more than one notification per `period`.
    class NotificationRateLimit
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Control over how the notification channels in `notification_channels`
    # are notified when this alert fires, on a per-channel basis.
    # @!attribute [rw] notification_channel_names
    #   @return [::Array<::String>]
    #     The full REST resource name for the notification channels that these
    #     settings apply to. Each of these correspond to the name field in one
    #     of the NotificationChannel objects referenced in the
    #     notification_channels field of this AlertPolicy.
    #     The format is:
    #
    #         projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
    # @!attribute [rw] renotify_interval
    #   @return [::Google::Protobuf::Duration]
    #     The frequency at which to send reminder notifications for open
    #     incidents.
    class NotificationChannelStrategy
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end
  end

  # @!attribute [rw] key
  #   @return [::String]
  # @!attribute [rw] value
  #   @return [::String]
  class UserLabelsEntry
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical `AND` operator. An
    # incident is created only if all the conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical `OR` operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical `AND` operator, but unlike the regular
    # `AND` option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end

  # An enumeration of possible severity level for an Alert Policy.
  module Severity
    # No severity is specified. This is the default value.
    SEVERITY_UNSPECIFIED = 0

    # This is the highest severity level. Use this if the problem could
    # cause significant damage or downtime.
    CRITICAL = 1

    # This is the medium severity level. Use this if the problem could
    # cause minor damage or downtime.
    ERROR = 2

    # This is the lowest severity level. Use this if the problem is not causing
    # any damage or downtime, but could potentially lead to a problem in the
    # future.
    WARNING = 3
  end
end