Class Condition (2.18.0)

Condition(mapping=None, *, ignore_unknown_fields=False, **kwargs)

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.

This message has oneof_ fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

Attributes

NameDescription
name str
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 alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy] 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 alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy] 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.
display_name str
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.
condition_threshold google.cloud.monitoring_v3.types.AlertPolicy.Condition.MetricThreshold
A condition that compares a time series against a threshold. This field is a member of oneof_ condition.
condition_absent google.cloud.monitoring_v3.types.AlertPolicy.Condition.MetricAbsence
A condition that checks that a time series continues to receive new data points. This field is a member of oneof_ condition.
condition_matched_log google.cloud.monitoring_v3.types.AlertPolicy.Condition.LogMatch
A condition that checks for log messages matching given constraints. If set, no other conditions can be present. This field is a member of oneof_ condition.
condition_monitoring_query_language google.cloud.monitoring_v3.types.AlertPolicy.Condition.MonitoringQueryLanguageCondition
A condition that uses the Monitoring Query Language to define alerts. This field is a member of oneof_ condition.
condition_prometheus_query_language google.cloud.monitoring_v3.types.AlertPolicy.Condition.PrometheusQueryLanguageCondition
A condition that uses the Prometheus query language to define alerts. This field is a member of oneof_ condition.

Classes

EvaluationMissingData

EvaluationMissingData(value)

A condition control that determines how metric-threshold conditions are evaluated when data stops arriving. This control doesn't affect metric-absence policies.

Values: EVALUATION_MISSING_DATA_UNSPECIFIED (0): An unspecified evaluation missing data option. Equivalent to EVALUATION_MISSING_DATA_NO_OP. EVALUATION_MISSING_DATA_INACTIVE (1): If there is no data to evaluate the condition, then evaluate the condition as false. EVALUATION_MISSING_DATA_ACTIVE (2): If there is no data to evaluate the condition, then evaluate the condition as true. EVALUATION_MISSING_DATA_NO_OP (3): Do not evaluate the condition to any value if there is no data.

LogMatch

LogMatch(mapping=None, *, ignore_unknown_fields=False, **kwargs)

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.

MetricAbsence

MetricAbsence(mapping=None, *, ignore_unknown_fields=False, **kwargs)

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.

MetricThreshold

MetricThreshold(mapping=None, *, ignore_unknown_fields=False, **kwargs)

A condition type that compares a collection of time series against a threshold.

MonitoringQueryLanguageCondition

MonitoringQueryLanguageCondition(
    mapping=None, *, ignore_unknown_fields=False, **kwargs
)

A condition type that allows alert policies to be defined using Monitoring Query Language <https://cloud.google.com/monitoring/mql>__.

PrometheusQueryLanguageCondition

PrometheusQueryLanguageCondition(
    mapping=None, *, ignore_unknown_fields=False, **kwargs
)

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

Trigger

Trigger(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Specifies how many time series must fail a predicate to trigger a condition. If not specified, then a {count: 1} trigger is used.

This message has oneof_ fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields