Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for evaluationMissingData in AlertPolicy #6295

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions mmv1/products/monitoring/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,16 @@ objects:
The absolute number of time series
that must fail the predicate for the
condition to be triggered.
- !ruby/object:Api::Type::Enum
name: evaluationMissingData
description: |
A condition control that determines how
metric-threshold conditions are evaluated when
data stops arriving.
values:
- :EVALUATION_MISSING_DATA_INACTIVE
- :EVALUATION_MISSING_DATA_ACTIVE
- :EVALUATION_MISSING_DATA_NO_OP
- !ruby/object:Api::Type::NestedObject
name: conditionThreshold
description: |
Expand Down Expand Up @@ -734,6 +744,16 @@ objects:
resource labels, and metric labels. This
field may not exceed 2048 Unicode characters
in length.
- !ruby/object:Api::Type::Enum
name: evaluationMissingData
description: |
A condition control that determines how
metric-threshold conditions are evaluated when
data stops arriving.
values:
- :EVALUATION_MISSING_DATA_INACTIVE
- :EVALUATION_MISSING_DATA_ACTIVE
- :EVALUATION_MISSING_DATA_NO_OP
- !ruby/object:Api::Type::String
name: displayName
required: true
Expand Down
7 changes: 7 additions & 0 deletions mmv1/products/monitoring/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ overrides: !ruby/object:Overrides::ResourceOverrides
primary_resource_id: "alert_policy"
vars:
alert_policy_display_name: "My Alert Policy"
- !ruby/object:Provider::Terraform::Examples
# skipping tests because the API is full of race conditions
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copy-pasted these lines from the example above.

skip_test: true
name: "monitoring_alert_policy_evaluation_missing_data"
primary_resource_id: "alert_policy"
vars:
alert_policy_display_name: "My Alert Policy"
custom_code: !ruby/object:Provider::Terraform::CustomCode
custom_import: templates/terraform/custom_import/self_link_as_name.erb
post_create: templates/terraform/post_create/set_computed_name.erb
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
resource "google_monitoring_alert_policy" "<%= ctx[:primary_resource_id] %>" {
display_name = "<%= ctx[:vars]["alert_policy_display_name"] %>"
combiner = "OR"
conditions {
display_name = "test condition"
condition_threshold {
filter = "metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\""
duration = "60s"
comparison = "COMPARISON_GT"
aggregations {
alignment_period = "60s"
per_series_aligner = "ALIGN_RATE"
}
evaluation_missing_data = "EVALUATION_MISSING_DATA_INACTIVE"
}
}

user_labels = {
foo = "bar"
}
}