Package com.google.monitoring.v3
Class AlertPolicy.Condition.PrometheusQueryLanguageCondition
- java.lang.Object
-
- com.google.protobuf.AbstractMessageLite
-
- com.google.protobuf.AbstractMessage
-
- com.google.protobuf.GeneratedMessageV3
-
- com.google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition
-
- All Implemented Interfaces:
AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
,com.google.protobuf.Message
,com.google.protobuf.MessageLite
,com.google.protobuf.MessageLiteOrBuilder
,com.google.protobuf.MessageOrBuilder
,Serializable
- Enclosing class:
- AlertPolicy.Condition
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 typegoogle.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class 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/).-
Nested classes/interfaces inherited from class com.google.protobuf.GeneratedMessageV3
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
-
-
Field Summary
Fields Modifier and Type Field 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
-
Method Summary
-
Methods inherited from class com.google.protobuf.GeneratedMessageV3
canUseUnsafe, computeStringSize, computeStringSizeNoTag, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, isStringEmpty, makeExtensionsImmutable, 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, writeStringNoTag
-
Methods inherited from class com.google.protobuf.AbstractMessage
findInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toString
-
Methods inherited from class com.google.protobuf.AbstractMessageLite
addAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeTo
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
QUERY_FIELD_NUMBER
public static final int QUERY_FIELD_NUMBER
- See Also:
- Constant Field Values
-
DURATION_FIELD_NUMBER
public static final int DURATION_FIELD_NUMBER
- See Also:
- Constant Field Values
-
EVALUATION_INTERVAL_FIELD_NUMBER
public static final int EVALUATION_INTERVAL_FIELD_NUMBER
- See Also:
- Constant Field Values
-
LABELS_FIELD_NUMBER
public static final int LABELS_FIELD_NUMBER
- See Also:
- Constant Field Values
-
RULE_GROUP_FIELD_NUMBER
public static final int RULE_GROUP_FIELD_NUMBER
- See Also:
- Constant Field Values
-
ALERT_RULE_FIELD_NUMBER
public static final int ALERT_RULE_FIELD_NUMBER
- See Also:
- Constant Field Values
-
-
Method Detail
-
newInstance
protected Object newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
- Overrides:
newInstance
in classcom.google.protobuf.GeneratedMessageV3
-
getDescriptor
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
-
internalGetMapField
protected com.google.protobuf.MapField internalGetMapField(int number)
- Overrides:
internalGetMapField
in classcom.google.protobuf.GeneratedMessageV3
-
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
- Specified by:
internalGetFieldAccessorTable
in classcom.google.protobuf.GeneratedMessageV3
-
getQuery
public 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];
- Specified by:
getQuery
in 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:
getQueryBytes
in interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
- Returns:
- The bytes for query.
-
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:
hasDuration
in 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:
getDuration
in interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
- Returns:
- The duration.
-
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:
getDurationOrBuilder
in 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:
hasEvaluationInterval
in 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:
getEvaluationInterval
in interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
- Returns:
- The evaluationInterval.
-
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:
getEvaluationIntervalOrBuilder
in interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
-
getLabelsCount
public int getLabelsCount()
Description copied from interface:AlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
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];
- Specified by:
getLabelsCount
in interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
-
containsLabels
public 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];
- Specified by:
containsLabels
in interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
-
getLabels
@Deprecated public Map<String,String> getLabels()
Deprecated.UsegetLabelsMap()
instead.- Specified by:
getLabels
in interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
-
getLabelsMap
public 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];
- Specified by:
getLabelsMap
in interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
-
getLabelsOrDefault
public 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];
- Specified by:
getLabelsOrDefault
in interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
-
getLabelsOrThrow
public 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];
- Specified by:
getLabelsOrThrow
in interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
-
getRuleGroup
public 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];
- Specified by:
getRuleGroup
in 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:
getRuleGroupBytes
in interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
- Returns:
- The bytes for ruleGroup.
-
getAlertRule
public 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];
- Specified by:
getAlertRule
in 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:
getAlertRuleBytes
in interfaceAlertPolicy.Condition.PrometheusQueryLanguageConditionOrBuilder
- Returns:
- The bytes for alertRule.
-
isInitialized
public final boolean isInitialized()
- Specified by:
isInitialized
in interfacecom.google.protobuf.MessageLiteOrBuilder
- Overrides:
isInitialized
in classcom.google.protobuf.GeneratedMessageV3
-
writeTo
public void writeTo(com.google.protobuf.CodedOutputStream output) throws IOException
- Specified by:
writeTo
in interfacecom.google.protobuf.MessageLite
- Overrides:
writeTo
in classcom.google.protobuf.GeneratedMessageV3
- Throws:
IOException
-
getSerializedSize
public int getSerializedSize()
- Specified by:
getSerializedSize
in interfacecom.google.protobuf.MessageLite
- Overrides:
getSerializedSize
in classcom.google.protobuf.GeneratedMessageV3
-
equals
public boolean equals(Object obj)
- Specified by:
equals
in interfacecom.google.protobuf.Message
- Overrides:
equals
in classcom.google.protobuf.AbstractMessage
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfacecom.google.protobuf.Message
- Overrides:
hashCode
in classcom.google.protobuf.AbstractMessage
-
parseFrom
public static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(InputStream input) throws IOException
- Throws:
IOException
-
parseFrom
public static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
- Throws:
IOException
-
parseDelimitedFrom
public static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseDelimitedFrom(InputStream input) throws IOException
- Throws:
IOException
-
parseDelimitedFrom
public static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
- Throws:
IOException
-
parseFrom
public static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
- Throws:
IOException
-
parseFrom
public static AlertPolicy.Condition.PrometheusQueryLanguageCondition parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
- Throws:
IOException
-
newBuilderForType
public AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder newBuilderForType()
- Specified by:
newBuilderForType
in interfacecom.google.protobuf.Message
- Specified by:
newBuilderForType
in interfacecom.google.protobuf.MessageLite
-
newBuilder
public static AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder newBuilder()
-
newBuilder
public static AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder newBuilder(AlertPolicy.Condition.PrometheusQueryLanguageCondition prototype)
-
toBuilder
public AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder toBuilder()
- Specified by:
toBuilder
in interfacecom.google.protobuf.Message
- Specified by:
toBuilder
in interfacecom.google.protobuf.MessageLite
-
newBuilderForType
protected AlertPolicy.Condition.PrometheusQueryLanguageCondition.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
- Specified by:
newBuilderForType
in classcom.google.protobuf.GeneratedMessageV3
-
getDefaultInstance
public static AlertPolicy.Condition.PrometheusQueryLanguageCondition getDefaultInstance()
-
parser
public static com.google.protobuf.Parser<AlertPolicy.Condition.PrometheusQueryLanguageCondition> parser()
-
getParserForType
public com.google.protobuf.Parser<AlertPolicy.Condition.PrometheusQueryLanguageCondition> getParserForType()
- Specified by:
getParserForType
in interfacecom.google.protobuf.Message
- Specified by:
getParserForType
in interfacecom.google.protobuf.MessageLite
- Overrides:
getParserForType
in classcom.google.protobuf.GeneratedMessageV3
-
getDefaultInstanceForType
public AlertPolicy.Condition.PrometheusQueryLanguageCondition getDefaultInstanceForType()
- Specified by:
getDefaultInstanceForType
in interfacecom.google.protobuf.MessageLiteOrBuilder
- Specified by:
getDefaultInstanceForType
in interfacecom.google.protobuf.MessageOrBuilder
-
-