public static final class AlertPolicy.Condition.PrometheusQueryLanguageCondition extends com.google.protobuf.GeneratedMessageV3 implements AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
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).Protobuf type
google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition| Modifier and Type | Class and Description |
|---|---|
static class |
AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder
A condition type that allows alert policies to be defined using
[Prometheus Query Language
(PromQL)](https://prometheus.io/docs/prometheus/latest/querying/basics/).
|
com.google.protobuf.GeneratedMessageV3.BuilderParent, com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageT extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT>,BuilderT extends com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageT,BuilderT>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessageOrBuilder<MessageT extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT>>, com.google.protobuf.GeneratedMessageV3.FieldAccessorTable, com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter| Modifier and Type | Field and Description |
|---|---|
static int |
ALERT_RULE_FIELD_NUMBER |
static int |
DURATION_FIELD_NUMBER |
static int |
EVALUATION_INTERVAL_FIELD_NUMBER |
static int |
LABELS_FIELD_NUMBER |
static int |
QUERY_FIELD_NUMBER |
static int |
RULE_GROUP_FIELD_NUMBER |
canUseUnsafe, computeStringSize, computeStringSizeNoTag, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyList, emptyLongList, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, isStringEmpty, makeExtensionsImmutable, makeMutableCopy, makeMutableCopy, mergeFromAndMakeImmutableInternal, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBooleanList, newBuilderForType, newDoubleList, newFloatList, newIntList, newLongList, parseDelimitedWithIOException, parseDelimitedWithIOException, parseUnknownField, parseUnknownFieldProto3, parseWithIOException, parseWithIOException, parseWithIOException, parseWithIOException, serializeBooleanMapTo, serializeIntegerMapTo, serializeLongMapTo, serializeStringMapTo, writeReplace, writeString, writeStringNoTagfindInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toStringaddAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final int QUERY_FIELD_NUMBER
public static final int DURATION_FIELD_NUMBER
public static final int EVALUATION_INTERVAL_FIELD_NUMBER
public static final int LABELS_FIELD_NUMBER
public static final int RULE_GROUP_FIELD_NUMBER
public static final int ALERT_RULE_FIELD_NUMBER
protected Object newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
newInstance in class com.google.protobuf.GeneratedMessageV3public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
protected com.google.protobuf.MapField internalGetMapField(int number)
internalGetMapField in class com.google.protobuf.GeneratedMessageV3protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3public String 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];getQuery in interface AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilderpublic 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];getQueryBytes in interface AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilderpublic 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];
hasDuration in interface AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilderpublic 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];
getDuration in interface AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilderpublic 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];
getDurationOrBuilder in interface AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilderpublic 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];
hasEvaluationInterval in interface AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilderpublic 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];
getEvaluationInterval in interface AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilderpublic 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];
getEvaluationIntervalOrBuilder in interface AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilderpublic int getLabelsCount()
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). 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];
getLabelsCount in interface AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilderpublic boolean containsLabels(String key)
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). 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];
containsLabels in interface AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder@Deprecated public Map<String,String> getLabels()
getLabelsMap() instead.getLabels in interface AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilderpublic Map<String,String> 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). 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];
getLabelsMap in interface AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilderpublic String getLabelsOrDefault(String key, String defaultValue)
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). 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];
getLabelsOrDefault in interface AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilderpublic String getLabelsOrThrow(String key)
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). 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];
getLabelsOrThrow in interface AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilderpublic String 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];getRuleGroup in interface AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilderpublic 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];getRuleGroupBytes in interface AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilderpublic String 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];getAlertRule in interface AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilderpublic 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];getAlertRuleBytes in interface AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilderpublic final boolean isInitialized()
isInitialized in interface com.google.protobuf.MessageLiteOrBuilderisInitialized in class com.google.protobuf.GeneratedMessageV3public void writeTo(com.google.protobuf.CodedOutputStream output)
throws IOException
writeTo in interface com.google.protobuf.MessageLitewriteTo in class com.google.protobuf.GeneratedMessageV3IOExceptionpublic int getSerializedSize()
getSerializedSize in interface com.google.protobuf.MessageLitegetSerializedSize in class com.google.protobuf.GeneratedMessageV3public boolean equals(Object obj)
equals in interface com.google.protobuf.Messageequals in class com.google.protobuf.AbstractMessagepublic int hashCode()
hashCode in interface com.google.protobuf.MessagehashCode in class com.google.protobuf.AbstractMessagepublic static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(InputStream input) throws IOException
IOExceptionpublic static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseDelimitedFrom(InputStream input) throws IOException
IOExceptionpublic static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
IOExceptionpublic static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder newBuilderForType()
newBuilderForType in interface com.google.protobuf.MessagenewBuilderForType in interface com.google.protobuf.MessageLitepublic static AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder newBuilder()
public static AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder newBuilder(AlertPolicy.Condition.PrometheusQueryLanguageCondition prototype)
public AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder toBuilder()
toBuilder in interface com.google.protobuf.MessagetoBuilder in interface com.google.protobuf.MessageLiteprotected AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
newBuilderForType in class com.google.protobuf.GeneratedMessageV3public static AlertPolicy.Condition.PrometheusQueryLanguageCondition getDefaultInstance()
public static com.google.protobuf.Parser<AlertPolicy.Condition.PrometheusQueryLanguageCondition> parser()
public com.google.protobuf.Parser<AlertPolicy.Condition.PrometheusQueryLanguageCondition> getParserForType()
getParserForType in interface com.google.protobuf.MessagegetParserForType in interface com.google.protobuf.MessageLitegetParserForType in class com.google.protobuf.GeneratedMessageV3public AlertPolicy.Condition.PrometheusQueryLanguageCondition getDefaultInstanceForType()
getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuildergetDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilderCopyright © 2023 Google LLC. All rights reserved.