Skip to content

Commit

Permalink
Make condition_prometheus_query_language.evaluation_interval optional (
Browse files Browse the repository at this point in the history
…#8564) (#6028)

* Add support for retriggering notifications in AlertPolicy

* Add support for forecast options in AlertPolicy

* Move tests for forecast alerts into the handwritten file

* Add support for PromQL condition type in AlertPolicy

* Added test for promql alerts into the handwritten file

* Add test for condition_prometheus_query_language.labels

* Remove trailing whitespace

* Update mmv1/products/monitoring/AlertPolicy.yaml

* Make condition_prometheus_query_language.evaluation_interval optional

* Remove test for condition_prometheus_query_language.evaluation_interval

---------

Signed-off-by: Modular Magician <[email protected]>
Co-authored-by: James Edouard <[email protected]>
Co-authored-by: Cameron Thornton <[email protected]>
  • Loading branch information
3 people authored Aug 8, 2023
1 parent aa7fa8d commit eec9e9a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .changelog/8564.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
monitoring: updated `evaluation_interval` on `condition_prometheus_query_language` to be optional
```
1 change: 0 additions & 1 deletion google-beta/resource_monitoring_alert_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ resource "google_monitoring_alert_policy" "promql" {
condition_prometheus_query_language {
query = "vector(1)"
duration = "60s"
evaluation_interval = "60s"
labels = {
"severity" = "page"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,15 +370,6 @@ from a Prometheus alerting rule and its associated rule group.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"evaluation_interval": {
Type: schema.TypeString,
Required: true,
Description: `How often this rule should be evaluated. Must be a positive multiple
of 30 seconds or missing. The 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.`,
},
"query": {
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -408,6 +399,15 @@ valid Prometheus label name.`,
to be "true" for this long. Alerts whose PromQL expression was not
evaluated to be "true" for long enough are considered pending. The
default value is zero. Must be zero or positive.`,
},
"evaluation_interval": {
Type: schema.TypeString,
Optional: true,
Description: `How often this rule should be evaluated. Must be a positive multiple
of 30 seconds or missing. The 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.`,
},
"labels": {
Type: schema.TypeMap,
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/monitoring_alert_policy.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ The following arguments are supported:
default value is zero. Must be zero or positive.

* `evaluation_interval` -
(Required)
(Optional)
How often this rule should be evaluated. Must be a positive multiple
of 30 seconds or missing. The default value is 30 seconds. If this
PrometheusQueryLanguageCondition was generated from a Prometheus
Expand Down

0 comments on commit eec9e9a

Please sign in to comment.