Reference documentation and code samples for the Stackdriver Monitoring V3 Client class Condition.
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.
Generated from protobuf messagegoogle.monitoring.v3.AlertPolicy.Condition
Namespace
Google \ Cloud \ Monitoring \ V3 \ AlertPolicy
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ name
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 thealertPolicies.createmethod, do not include thenamefield in the conditions of the requested alerting policy. Cloud Monitoring creates the condition identifiers and includes them in the new policy. When calling thealertPolicies.updatemethod to update a policy, including a conditionnamecauses 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
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.
A condition that periodically evaluates a SQL query result.
getName
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 thealertPolicies.createmethod, do not include thenamefield in the conditions of the
requested alerting policy. Cloud Monitoring creates the
condition identifiers and includes them in the new policy.
When calling thealertPolicies.updatemethod to update a policy, including a conditionnamecauses 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.
Returns
Type
Description
string
setName
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 thealertPolicies.createmethod, do not include thenamefield in the conditions of the
requested alerting policy. Cloud Monitoring creates the
condition identifiers and includes them in the new policy.
When calling thealertPolicies.updatemethod to update a policy, including a conditionnamecauses 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.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getDisplayName
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.
Returns
Type
Description
string
setDisplayName
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.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getConditionThreshold
A condition that compares a time series against a threshold.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Stackdriver Monitoring V3 Client - Class Condition (2.1.2)\n\nVersion latestkeyboard_arrow_down\n\n- [2.1.2 (latest)](/php/docs/reference/cloud-monitoring/latest/V3.AlertPolicy.Condition)\n- [2.1.1](/php/docs/reference/cloud-monitoring/2.1.1/V3.AlertPolicy.Condition)\n- [2.0.1](/php/docs/reference/cloud-monitoring/2.0.1/V3.AlertPolicy.Condition)\n- [1.12.1](/php/docs/reference/cloud-monitoring/1.12.1/V3.AlertPolicy.Condition)\n- [1.11.1](/php/docs/reference/cloud-monitoring/1.11.1/V3.AlertPolicy.Condition)\n- [1.10.3](/php/docs/reference/cloud-monitoring/1.10.3/V3.AlertPolicy.Condition)\n- [1.9.0](/php/docs/reference/cloud-monitoring/1.9.0/V3.AlertPolicy.Condition)\n- [1.8.0](/php/docs/reference/cloud-monitoring/1.8.0/V3.AlertPolicy.Condition)\n- [1.7.1](/php/docs/reference/cloud-monitoring/1.7.1/V3.AlertPolicy.Condition)\n- [1.6.0](/php/docs/reference/cloud-monitoring/1.6.0/V3.AlertPolicy.Condition)\n- [1.5.1](/php/docs/reference/cloud-monitoring/1.5.1/V3.AlertPolicy.Condition)\n- [1.4.0](/php/docs/reference/cloud-monitoring/1.4.0/V3.AlertPolicy.Condition)\n- [1.3.2](/php/docs/reference/cloud-monitoring/1.3.2/V3.AlertPolicy.Condition)\n- [1.2.2](/php/docs/reference/cloud-monitoring/1.2.2/V3.AlertPolicy.Condition) \nReference documentation and code samples for the Stackdriver Monitoring V3 Client class Condition.\n\nA condition is a true/false test that determines when an alerting policy\nshould open an incident. If a condition evaluates to true, it signifies\nthat something is wrong.\n\nGenerated from protobuf message `google.monitoring.v3.AlertPolicy.Condition`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Monitoring \\\\ V3 \\\\ AlertPolicy\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getName\n\nRequired if the condition exists. The unique resource name for this\ncondition. Its format is:\nprojects/\\[PROJECT_ID_OR_NUMBER\\]/alertPolicies/\\[POLICY_ID\\]/conditions/\\[CONDITION_ID\\]\n`[CONDITION_ID]` is assigned by Cloud Monitoring when the\ncondition is created as part of a new or updated alerting policy.\n\nWhen calling the\n[alertPolicies.create](/php/docs/reference/cloud-monitoring/latest/V3.Client.AlertPolicyServiceClient#_Google_Cloud_Monitoring_V3_Client_AlertPolicyServiceClient__createAlertPolicy__)\nmethod, do not include the `name` field in the conditions of the\nrequested alerting policy. Cloud Monitoring creates the\ncondition identifiers and includes them in the new policy.\nWhen calling the\n[alertPolicies.update](/php/docs/reference/cloud-monitoring/latest/V3.Client.AlertPolicyServiceClient#_Google_Cloud_Monitoring_V3_Client_AlertPolicyServiceClient__updateAlertPolicy__)\nmethod to update a policy, including a condition `name` causes the\nexisting condition to be updated. Conditions without names are added to\nthe updated policy. Existing conditions are deleted if they are not\nupdated.\nBest practice is to preserve `[CONDITION_ID]` if you make only small\nchanges, such as those to condition thresholds, durations, or trigger\nvalues. Otherwise, treat the change as a new condition and let the\nexisting condition be deleted.\n\n### setName\n\nRequired if the condition exists. The unique resource name for this\ncondition. Its format is:\nprojects/\\[PROJECT_ID_OR_NUMBER\\]/alertPolicies/\\[POLICY_ID\\]/conditions/\\[CONDITION_ID\\]\n`[CONDITION_ID]` is assigned by Cloud Monitoring when the\ncondition is created as part of a new or updated alerting policy.\n\nWhen calling the\n[alertPolicies.create](/php/docs/reference/cloud-monitoring/latest/V3.Client.AlertPolicyServiceClient#_Google_Cloud_Monitoring_V3_Client_AlertPolicyServiceClient__createAlertPolicy__)\nmethod, do not include the `name` field in the conditions of the\nrequested alerting policy. Cloud Monitoring creates the\ncondition identifiers and includes them in the new policy.\nWhen calling the\n[alertPolicies.update](/php/docs/reference/cloud-monitoring/latest/V3.Client.AlertPolicyServiceClient#_Google_Cloud_Monitoring_V3_Client_AlertPolicyServiceClient__updateAlertPolicy__)\nmethod to update a policy, including a condition `name` causes the\nexisting condition to be updated. Conditions without names are added to\nthe updated policy. Existing conditions are deleted if they are not\nupdated.\nBest practice is to preserve `[CONDITION_ID]` if you make only small\nchanges, such as those to condition thresholds, durations, or trigger\nvalues. Otherwise, treat the change as a new condition and let the\nexisting condition be deleted.\n\n### getDisplayName\n\nA short name or phrase used to identify the condition in dashboards,\nnotifications, and incidents. To avoid confusion, don't use the same\ndisplay name for multiple conditions in the same policy.\n\n### setDisplayName\n\nA short name or phrase used to identify the condition in dashboards,\nnotifications, and incidents. To avoid confusion, don't use the same\ndisplay name for multiple conditions in the same policy.\n\n### getConditionThreshold\n\nA condition that compares a time series against a threshold.\n\n### hasConditionThreshold\n\n### setConditionThreshold\n\nA condition that compares a time series against a threshold.\n\n### getConditionAbsent\n\nA condition that checks that a time series continues to\nreceive new data points.\n\n### hasConditionAbsent\n\n### setConditionAbsent\n\nA condition that checks that a time series continues to\nreceive new data points.\n\n### getConditionMatchedLog\n\nA condition that checks for log messages matching given constraints. If\nset, no other conditions can be present.\n\n### hasConditionMatchedLog\n\n### setConditionMatchedLog\n\nA condition that checks for log messages matching given constraints. If\nset, no other conditions can be present.\n\n### getConditionMonitoringQueryLanguage\n\nA condition that uses the Monitoring Query Language to define\nalerts.\n\n### hasConditionMonitoringQueryLanguage\n\n### setConditionMonitoringQueryLanguage\n\nA condition that uses the Monitoring Query Language to define\nalerts.\n\n### getConditionPrometheusQueryLanguage\n\nA condition that uses the Prometheus query language to define alerts.\n\n### hasConditionPrometheusQueryLanguage\n\n### setConditionPrometheusQueryLanguage\n\nA condition that uses the Prometheus query language to define alerts.\n\n### getConditionSql\n\nA condition that periodically evaluates a SQL query result.\n\n### hasConditionSql\n\n### setConditionSql\n\nA condition that periodically evaluates a SQL query result.\n\n### getCondition"]]