Class: Google::Apis::MonitoringV3::PrometheusQueryLanguageCondition
- Inherits:
-
Object
- Object
- Google::Apis::MonitoringV3::PrometheusQueryLanguageCondition
- Includes:
- Core::Hashable, Core::JsonObjectSupport
- Defined in:
- lib/google/apis/monitoring_v3/classes.rb,
lib/google/apis/monitoring_v3/representations.rb,
lib/google/apis/monitoring_v3/representations.rb
Overview
A condition type that allows alerting 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).
Instance Attribute Summary collapse
-
#alert_rule ⇒ String
Optional.
-
#disable_metric_validation ⇒ Boolean
(also: #disable_metric_validation?)
Optional.
-
#duration ⇒ String
Optional.
-
#evaluation_interval ⇒ String
Optional.
-
#labels ⇒ Hash<String,String>
Optional.
-
#query ⇒ String
Required.
-
#rule_group ⇒ String
Optional.
Instance Method Summary collapse
-
#initialize(**args) ⇒ PrometheusQueryLanguageCondition
constructor
A new instance of PrometheusQueryLanguageCondition.
-
#update!(**args) ⇒ Object
Update properties of this object.
Constructor Details
#initialize(**args) ⇒ PrometheusQueryLanguageCondition
Returns a new instance of PrometheusQueryLanguageCondition.
4022 4023 4024 |
# File 'lib/google/apis/monitoring_v3/classes.rb', line 4022 def initialize(**args) update!(**args) end |
Instance Attribute Details
#alert_rule ⇒ 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.
Corresponds to the JSON property alertRule
3963 3964 3965 |
# File 'lib/google/apis/monitoring_v3/classes.rb', line 3963 def alert_rule @alert_rule end |
#disable_metric_validation ⇒ Boolean Also known as: disable_metric_validation?
Optional. Whether to disable metric existence validation for this condition.
This allows alerting policies to be defined on metrics that do not yet exist,
improving advanced customer workflows such as configuring alerting policies
using Terraform.Users with the monitoring.alertPolicyViewer role are able to
see the name of the non-existent metric in the alerting policy condition.
Corresponds to the JSON property disableMetricValidation
3972 3973 3974 |
# File 'lib/google/apis/monitoring_v3/classes.rb', line 3972 def disable_metric_validation @disable_metric_validation end |
#duration ⇒ String
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.
Corresponds to the JSON property duration
3982 3983 3984 |
# File 'lib/google/apis/monitoring_v3/classes.rb', line 3982 def duration @duration end |
#evaluation_interval ⇒ String
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.
Corresponds to the JSON property evaluationInterval
3991 3992 3993 |
# File 'lib/google/apis/monitoring_v3/classes.rb', line 3991 def evaluation_interval @evaluation_interval end |
#labels ⇒ Hash<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#doc-vars). The only available
variable names are the names of the labels in the PromQL result, including "
name" and "value". "labels" may be empty.
Corresponds to the JSON property labels
4001 4002 4003 |
# File 'lib/google/apis/monitoring_v3/classes.rb', line 4001 def labels @labels end |
#query ⇒ 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.
Corresponds to the JSON property query
4008 4009 4010 |
# File 'lib/google/apis/monitoring_v3/classes.rb', line 4008 def query @query end |
#rule_group ⇒ 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.
Corresponds to the JSON property ruleGroup
4020 4021 4022 |
# File 'lib/google/apis/monitoring_v3/classes.rb', line 4020 def rule_group @rule_group end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
4027 4028 4029 4030 4031 4032 4033 4034 4035 |
# File 'lib/google/apis/monitoring_v3/classes.rb', line 4027 def update!(**args) @alert_rule = args[:alert_rule] if args.key?(:alert_rule) @disable_metric_validation = args[:disable_metric_validation] if args.key?(:disable_metric_validation) @duration = args[:duration] if args.key?(:duration) @evaluation_interval = args[:evaluation_interval] if args.key?(:evaluation_interval) @labels = args[:labels] if args.key?(:labels) @query = args[:query] if args.key?(:query) @rule_group = args[:rule_group] if args.key?(:rule_group) end |