Package com.google.monitoring.v3
Class AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder
java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderT>
com.google.protobuf.GeneratedMessage.Builder<AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder>
com.google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder
- All Implemented Interfaces:
AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder,com.google.protobuf.Message.Builder,com.google.protobuf.MessageLite.Builder,com.google.protobuf.MessageLiteOrBuilder,com.google.protobuf.MessageOrBuilder,Cloneable
- Enclosing class:
- AlertPolicy.Condition.PrometheusQueryLanguageCondition
public static final class AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder
extends com.google.protobuf.GeneratedMessage.Builder<AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder>
implements AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
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).Protobuf type
google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition-
Method Summary
Modifier and TypeMethodDescriptionbuild()clear()Optional.Optional.Optional.Optional.Required.Optional.booleancontainsLabels(String key) Optional.Optional.com.google.protobuf.ByteStringOptional.static final com.google.protobuf.Descriptors.Descriptorcom.google.protobuf.Descriptors.DescriptorbooleanOptional.com.google.protobuf.DurationOptional.com.google.protobuf.Duration.BuilderOptional.com.google.protobuf.DurationOrBuilderOptional.com.google.protobuf.DurationOptional.com.google.protobuf.Duration.BuilderOptional.com.google.protobuf.DurationOrBuilderOptional.Deprecated.intOptional.Optional.getLabelsOrDefault(String key, String defaultValue) Optional.getLabelsOrThrow(String key) Optional.Deprecated.getQuery()Required.com.google.protobuf.ByteStringRequired.Optional.com.google.protobuf.ByteStringOptional.booleanOptional.booleanOptional.protected com.google.protobuf.GeneratedMessage.FieldAccessorTableprotected com.google.protobuf.MapFieldReflectionAccessorinternalGetMapFieldReflection(int number) protected com.google.protobuf.MapFieldReflectionAccessorinternalGetMutableMapFieldReflection(int number) final booleanmergeDuration(com.google.protobuf.Duration value) Optional.mergeEvaluationInterval(com.google.protobuf.Duration value) Optional.mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) mergeFrom(com.google.protobuf.Message other) putAllLabels(Map<String, String> values) Optional.Optional.removeLabels(String key) Optional.setAlertRule(String value) Optional.setAlertRuleBytes(com.google.protobuf.ByteString value) Optional.setDisableMetricValidation(boolean value) Optional.setDuration(com.google.protobuf.Duration value) Optional.setDuration(com.google.protobuf.Duration.Builder builderForValue) Optional.setEvaluationInterval(com.google.protobuf.Duration value) Optional.setEvaluationInterval(com.google.protobuf.Duration.Builder builderForValue) Optional.Required.setQueryBytes(com.google.protobuf.ByteString value) Required.setRuleGroup(String value) Optional.setRuleGroupBytes(com.google.protobuf.ByteString value) Optional.Methods inherited from class com.google.protobuf.GeneratedMessage.Builder
addRepeatedField, clearField, clearOneof, clone, getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMutableMapField, isClean, markClean, mergeUnknownFields, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setField, setRepeatedField, setUnknownFields, setUnknownFieldSetBuilder, setUnknownFieldsProto3Methods inherited from class com.google.protobuf.AbstractMessage.Builder
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toStringMethods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageExceptionMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.protobuf.Message.Builder
mergeDelimitedFrom, mergeDelimitedFromMethods inherited from interface com.google.protobuf.MessageLite.Builder
mergeFromMethods inherited from interface com.google.protobuf.MessageOrBuilder
findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
-
Method Details
-
getDescriptor
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() -
internalGetMapFieldReflection
protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection(int number) - Overrides:
internalGetMapFieldReflectionin classcom.google.protobuf.GeneratedMessage.Builder<AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder>
-
internalGetMutableMapFieldReflection
protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection(int number) - Overrides:
internalGetMutableMapFieldReflectionin classcom.google.protobuf.GeneratedMessage.Builder<AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder>
-
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()- Specified by:
internalGetFieldAccessorTablein classcom.google.protobuf.GeneratedMessage.Builder<AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder>
-
clear
- Specified by:
clearin interfacecom.google.protobuf.Message.Builder- Specified by:
clearin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clearin classcom.google.protobuf.GeneratedMessage.Builder<AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder>
-
getDescriptorForType
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.Message.Builder- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.MessageOrBuilder- Overrides:
getDescriptorForTypein classcom.google.protobuf.GeneratedMessage.Builder<AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder>
-
getDefaultInstanceForType
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-
build
- Specified by:
buildin interfacecom.google.protobuf.Message.Builder- Specified by:
buildin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
- Specified by:
buildPartialin interfacecom.google.protobuf.Message.Builder- Specified by:
buildPartialin interfacecom.google.protobuf.MessageLite.Builder
-
mergeFrom
public AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder mergeFrom(com.google.protobuf.Message other) - Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder>
-
mergeFrom
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.google.protobuf.GeneratedMessage.Builder<AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder>
-
mergeFrom
public AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Specified by:
mergeFromin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder>- Throws:
IOException
-
getQuery
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.
string query = 1 [(.google.api.field_behavior) = REQUIRED];- Specified by:
getQueryin interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder- Returns:
- The query.
-
getQueryBytes
public com.google.protobuf.ByteString getQueryBytes()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.
string query = 1 [(.google.api.field_behavior) = REQUIRED];- Specified by:
getQueryBytesin interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder- Returns:
- The bytes for query.
-
setQuery
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.
string query = 1 [(.google.api.field_behavior) = REQUIRED];- Parameters:
value- The query to set.- Returns:
- This builder for chaining.
-
clearQuery
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.
string query = 1 [(.google.api.field_behavior) = REQUIRED];- Returns:
- This builder for chaining.
-
setQueryBytes
public AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder setQueryBytes(com.google.protobuf.ByteString value) 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.
string query = 1 [(.google.api.field_behavior) = REQUIRED];- Parameters:
value- The bytes for query to set.- Returns:
- This builder for chaining.
-
hasDuration
public boolean hasDuration()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.
.google.protobuf.Duration duration = 2 [(.google.api.field_behavior) = OPTIONAL];- Specified by:
hasDurationin interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder- Returns:
- Whether the duration field is set.
-
getDuration
public com.google.protobuf.Duration getDuration()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.
.google.protobuf.Duration duration = 2 [(.google.api.field_behavior) = OPTIONAL];- Specified by:
getDurationin interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder- Returns:
- The duration.
-
setDuration
public AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder setDuration(com.google.protobuf.Duration value) 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.
.google.protobuf.Duration duration = 2 [(.google.api.field_behavior) = OPTIONAL]; -
setDuration
public AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder setDuration(com.google.protobuf.Duration.Builder builderForValue) 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.
.google.protobuf.Duration duration = 2 [(.google.api.field_behavior) = OPTIONAL]; -
mergeDuration
public AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder mergeDuration(com.google.protobuf.Duration value) 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.
.google.protobuf.Duration duration = 2 [(.google.api.field_behavior) = OPTIONAL]; -
clearDuration
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.
.google.protobuf.Duration duration = 2 [(.google.api.field_behavior) = OPTIONAL]; -
getDurationBuilder
public com.google.protobuf.Duration.Builder getDurationBuilder()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.
.google.protobuf.Duration duration = 2 [(.google.api.field_behavior) = OPTIONAL]; -
getDurationOrBuilder
public com.google.protobuf.DurationOrBuilder getDurationOrBuilder()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.
.google.protobuf.Duration duration = 2 [(.google.api.field_behavior) = OPTIONAL];- Specified by:
getDurationOrBuilderin interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
-
hasEvaluationInterval
public boolean hasEvaluationInterval()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.
.google.protobuf.Duration evaluation_interval = 3 [(.google.api.field_behavior) = OPTIONAL];- Specified by:
hasEvaluationIntervalin interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder- Returns:
- Whether the evaluationInterval field is set.
-
getEvaluationInterval
public com.google.protobuf.Duration getEvaluationInterval()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.
.google.protobuf.Duration evaluation_interval = 3 [(.google.api.field_behavior) = OPTIONAL];- Specified by:
getEvaluationIntervalin interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder- Returns:
- The evaluationInterval.
-
setEvaluationInterval
public AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder setEvaluationInterval(com.google.protobuf.Duration value) 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.
.google.protobuf.Duration evaluation_interval = 3 [(.google.api.field_behavior) = OPTIONAL]; -
setEvaluationInterval
public AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder setEvaluationInterval(com.google.protobuf.Duration.Builder builderForValue) 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.
.google.protobuf.Duration evaluation_interval = 3 [(.google.api.field_behavior) = OPTIONAL]; -
mergeEvaluationInterval
public AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder mergeEvaluationInterval(com.google.protobuf.Duration value) 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.
.google.protobuf.Duration evaluation_interval = 3 [(.google.api.field_behavior) = OPTIONAL]; -
clearEvaluationInterval
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.
.google.protobuf.Duration evaluation_interval = 3 [(.google.api.field_behavior) = OPTIONAL]; -
getEvaluationIntervalBuilder
public com.google.protobuf.Duration.Builder getEvaluationIntervalBuilder()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.
.google.protobuf.Duration evaluation_interval = 3 [(.google.api.field_behavior) = OPTIONAL]; -
getEvaluationIntervalOrBuilder
public com.google.protobuf.DurationOrBuilder getEvaluationIntervalOrBuilder()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.
.google.protobuf.Duration evaluation_interval = 3 [(.google.api.field_behavior) = OPTIONAL];- Specified by:
getEvaluationIntervalOrBuilderin interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
-
getLabelsCount
public int getLabelsCount()Description copied from interface:AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilderOptional. 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.
map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL];- Specified by:
getLabelsCountin interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
-
containsLabels
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.
map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL];- Specified by:
containsLabelsin interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
-
getLabels
Deprecated.UsegetLabelsMap()instead.- Specified by:
getLabelsin interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
-
getLabelsMap
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.
map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL];- Specified by:
getLabelsMapin interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
-
getLabelsOrDefault
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.
map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL];- Specified by:
getLabelsOrDefaultin interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
-
getLabelsOrThrow
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.
map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL];- Specified by:
getLabelsOrThrowin interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
-
clearLabels
-
removeLabels
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.
map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; -
getMutableLabels
Deprecated.Use alternate mutation accessors instead. -
putLabels
public AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder putLabels(String key, String value) 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.
map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; -
putAllLabels
public AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder putAllLabels(Map<String, String> values) 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.
map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL]; -
getRuleGroup
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.
string rule_group = 5 [(.google.api.field_behavior) = OPTIONAL];- Specified by:
getRuleGroupin interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder- Returns:
- The ruleGroup.
-
getRuleGroupBytes
public com.google.protobuf.ByteString getRuleGroupBytes()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.
string rule_group = 5 [(.google.api.field_behavior) = OPTIONAL];- Specified by:
getRuleGroupBytesin interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder- Returns:
- The bytes for ruleGroup.
-
setRuleGroup
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.
string rule_group = 5 [(.google.api.field_behavior) = OPTIONAL];- Parameters:
value- The ruleGroup to set.- Returns:
- This builder for chaining.
-
clearRuleGroup
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.
string rule_group = 5 [(.google.api.field_behavior) = OPTIONAL];- Returns:
- This builder for chaining.
-
setRuleGroupBytes
public AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder setRuleGroupBytes(com.google.protobuf.ByteString value) 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.
string rule_group = 5 [(.google.api.field_behavior) = OPTIONAL];- Parameters:
value- The bytes for ruleGroup to set.- Returns:
- This builder for chaining.
-
getAlertRule
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.
string alert_rule = 6 [(.google.api.field_behavior) = OPTIONAL];- Specified by:
getAlertRulein interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder- Returns:
- The alertRule.
-
getAlertRuleBytes
public com.google.protobuf.ByteString getAlertRuleBytes()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.
string alert_rule = 6 [(.google.api.field_behavior) = OPTIONAL];- Specified by:
getAlertRuleBytesin interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder- Returns:
- The bytes for alertRule.
-
setAlertRule
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.
string alert_rule = 6 [(.google.api.field_behavior) = OPTIONAL];- Parameters:
value- The alertRule to set.- Returns:
- This builder for chaining.
-
clearAlertRule
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.
string alert_rule = 6 [(.google.api.field_behavior) = OPTIONAL];- Returns:
- This builder for chaining.
-
setAlertRuleBytes
public AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder setAlertRuleBytes(com.google.protobuf.ByteString value) 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.
string alert_rule = 6 [(.google.api.field_behavior) = OPTIONAL];- Parameters:
value- The bytes for alertRule to set.- Returns:
- This builder for chaining.
-
getDisableMetricValidation
public boolean getDisableMetricValidation()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.
bool disable_metric_validation = 7 [(.google.api.field_behavior) = OPTIONAL];- Specified by:
getDisableMetricValidationin interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder- Returns:
- The disableMetricValidation.
-
setDisableMetricValidation
public AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder setDisableMetricValidation(boolean value) 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.
bool disable_metric_validation = 7 [(.google.api.field_behavior) = OPTIONAL];- Parameters:
value- The disableMetricValidation to set.- Returns:
- This builder for chaining.
-
clearDisableMetricValidation
public AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder clearDisableMetricValidation()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.
bool disable_metric_validation = 7 [(.google.api.field_behavior) = OPTIONAL];- Returns:
- This builder for chaining.
-