Class: Google::Cloud::Monitoring::V3::AlertPolicy::Condition::PrometheusQueryLanguageCondition

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

Overview

A condition type that allows alert policies to be defined using Prometheus Query Language (PromQL).

The PrometheusQueryLanguageCondition message contains information from a Prometheus alerting rule and its associated rule group.

A Prometheus alerting rule is described here. The semantics of a Prometheus alerting rule is described here.

A Prometheus rule group is described here. The semantics of a Prometheus rule group is described here.

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).

Defined Under Namespace

Classes: LabelsEntry

Instance Attribute Summary collapse

Instance Attribute Details

#alert_rule::String

Returns 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. This field may not exceed 2048 Unicode characters in length.

Returns:

  • (::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. This field may not exceed 2048 Unicode characters in length.



566
567
568
569
570
571
572
573
574
575
576
577
578
# File 'proto_docs/google/monitoring/v3/alert.rb', line 566

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

#duration::Google::Protobuf::Duration

Returns 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.

Returns:

  • (::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.



566
567
568
569
570
571
572
573
574
575
576
577
578
# File 'proto_docs/google/monitoring/v3/alert.rb', line 566

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

#evaluation_interval::Google::Protobuf::Duration

Returns 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.

Returns:

  • (::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.



566
567
568
569
570
571
572
573
574
575
576
577
578
# File 'proto_docs/google/monitoring/v3/alert.rb', line 566

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

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

Returns Optional. Labels to add to or overwrite in the PromQL query result. Label names must be valid. Label values can be templatized by using variables. The only available variable names are the names of the labels in the PromQL result, including "name" and "value". "labels" may be empty.

Returns:

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

    Optional. Labels to add to or overwrite in the PromQL query result. Label names must be valid. Label values can be templatized by using variables. The only available variable names are the names of the labels in the PromQL result, including "name" and "value". "labels" may be empty.



566
567
568
569
570
571
572
573
574
575
576
577
578
# File 'proto_docs/google/monitoring/v3/alert.rb', line 566

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

#query::String

Returns 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.

Returns:

  • (::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.



566
567
568
569
570
571
572
573
574
575
576
577
578
# File 'proto_docs/google/monitoring/v3/alert.rb', line 566

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

#rule_group::String

Returns 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.

Returns:

  • (::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.



566
567
568
569
570
571
572
573
574
575
576
577
578
# File 'proto_docs/google/monitoring/v3/alert.rb', line 566

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