MON-230 Standardize filter and split delays
This commit is contained in:
parent
0177d37686
commit
cb7dd538f3
@ -42,18 +42,17 @@ Creates DataDog monitors with the following checks:
|
||||
| concurrent_queries_threshold_critical | Concurrent Queries (critical threshold) (hard limit 50) | string | `45` | no |
|
||||
| concurrent_queries_threshold_warning | Concurrent Queries (warning threshold) (hard limit 50) | string | `40` | no |
|
||||
| concurrent_queries_timeframe | Timeframe for the Concurrent Queries monitor | string | `last_5m` | no |
|
||||
| delay | Delay in seconds for the metric evaluation | string | `900` | no |
|
||||
| environment | Architecture environment | string | - | yes |
|
||||
| evaluation_delay | Delay in seconds for the metric evaluation | string | `900` | no |
|
||||
| execution_time_extra_tags | Extra tags for GCP Big Query Execution Time monitor | list | `<list>` | no |
|
||||
| execution_time_message | Custom message for the Execution Time monitor | string | `` | no |
|
||||
| execution_time_silenced | Groups to mute for GCP Big Query Execution Time monitor. Muted by default. | map | `<map>` | no |
|
||||
| execution_time_threshold_critical | Average Execution Time in seconds (critical threshold) | string | `150` | no |
|
||||
| execution_time_threshold_warning | Average Execution Time in seconds (warning threshold) | string | `100` | no |
|
||||
| execution_time_timeframe | Timeframe for the Execution Time monitor | string | `last_5m` | no |
|
||||
| filter_tags_custom | Tags used for custom filtering when filter_tags_use_defaults is false | string | `*` | no |
|
||||
| filter_tags_use_defaults | Use default filter tags convention | string | `true` | no |
|
||||
| filter_tags | Tags used for filtering | string | `*` | no |
|
||||
| message | Message sent when a monitor is triggered | string | - | yes |
|
||||
| project_id | ID of the GCP Project | string | - | yes |
|
||||
| new_host_delay | Delay in seconds for the new host evaluation | string | `300` | no |
|
||||
| scanned_bytes_billed_extra_tags | Extra tags for GCP Big Query Scanned Bytes Billed monitor | list | `<list>` | no |
|
||||
| scanned_bytes_billed_message | Custom message for the Scanned Bytes Billed monitor | string | `` | no |
|
||||
| scanned_bytes_billed_silenced | Groups to mute for GCP Big Query Scanned Bytes Billed monitor. Muted by default. | map | `<map>` | no |
|
||||
|
||||
@ -7,13 +7,8 @@ variable "environment" {
|
||||
type = "string"
|
||||
}
|
||||
|
||||
variable "filter_tags_use_defaults" {
|
||||
description = "Use default filter tags convention"
|
||||
default = "true"
|
||||
}
|
||||
|
||||
variable "filter_tags_custom" {
|
||||
description = "Tags used for custom filtering when filter_tags_use_defaults is false"
|
||||
variable "filter_tags" {
|
||||
description = "Tags used for filtering"
|
||||
default = "*"
|
||||
}
|
||||
|
||||
@ -21,18 +16,14 @@ variable "message" {
|
||||
description = "Message sent when a monitor is triggered"
|
||||
}
|
||||
|
||||
variable "delay" {
|
||||
variable "evaluation_delay" {
|
||||
description = "Delay in seconds for the metric evaluation"
|
||||
default = 900
|
||||
}
|
||||
|
||||
#
|
||||
# Filter variables
|
||||
#
|
||||
|
||||
variable "project_id" {
|
||||
type = "string"
|
||||
description = "ID of the GCP Project"
|
||||
variable "new_host_delay" {
|
||||
description = "Delay in seconds for the new host evaluation"
|
||||
default = 300
|
||||
}
|
||||
|
||||
#
|
||||
|
||||
@ -1,16 +1,3 @@
|
||||
#
|
||||
# FILTER
|
||||
#
|
||||
data "template_file" "filter" {
|
||||
template = "$${filter}"
|
||||
|
||||
vars {
|
||||
filter = "${var.filter_tags_use_defaults == "true" ?
|
||||
format("project_id:%s", var.project_id) :
|
||||
"${var.filter_tags_custom}"}"
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Concurrent queries
|
||||
#
|
||||
@ -21,7 +8,7 @@ resource "datadog_monitor" "concurrent_queries" {
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.concurrent_queries_timeframe}): avg:gcp.bigquery.query.count{${data.template_file.filter.rendered}}
|
||||
avg(${var.concurrent_queries_timeframe}): avg:gcp.bigquery.query.count{${var.filter_tags}}
|
||||
> ${var.concurrent_queries_threshold_critical}
|
||||
EOF
|
||||
|
||||
@ -38,8 +25,8 @@ EOF
|
||||
timeout_h = 0
|
||||
locked = false
|
||||
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
new_host_delay = "${var.new_host_delay}"
|
||||
|
||||
silenced = "${var.concurrent_queries_silenced}"
|
||||
|
||||
@ -63,7 +50,7 @@ resource "datadog_monitor" "execution_time" {
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.execution_time_timeframe}): avg:gcp.bigquery.query.execution_times.avg{${data.template_file.filter.rendered}}
|
||||
avg(${var.execution_time_timeframe}): avg:gcp.bigquery.query.execution_times.avg{${var.filter_tags}}
|
||||
> ${var.execution_time_threshold_critical}
|
||||
EOF
|
||||
|
||||
@ -80,8 +67,8 @@ EOF
|
||||
timeout_h = 0
|
||||
locked = false
|
||||
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
new_host_delay = "${var.new_host_delay}"
|
||||
|
||||
silenced = "${var.execution_time_silenced}"
|
||||
|
||||
@ -105,7 +92,7 @@ resource "datadog_monitor" "scanned_bytes" {
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.scanned_bytes_timeframe}): avg:gcp.bigquery.query.scanned_bytes{${data.template_file.filter.rendered}}
|
||||
avg(${var.scanned_bytes_timeframe}): avg:gcp.bigquery.query.scanned_bytes{${var.filter_tags}}
|
||||
> ${var.scanned_bytes_threshold_critical}
|
||||
EOF
|
||||
|
||||
@ -122,8 +109,8 @@ EOF
|
||||
timeout_h = 0
|
||||
locked = false
|
||||
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
new_host_delay = "${var.new_host_delay}"
|
||||
|
||||
silenced = "${var.scanned_bytes_silenced}"
|
||||
|
||||
@ -147,7 +134,7 @@ resource "datadog_monitor" "scanned_bytes_billed" {
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.scanned_bytes_billed_timeframe}): avg:gcp.bigquery.query.scanned_bytes_billed{${data.template_file.filter.rendered}}
|
||||
avg(${var.scanned_bytes_billed_timeframe}): avg:gcp.bigquery.query.scanned_bytes_billed{${var.filter_tags}}
|
||||
> ${var.scanned_bytes_billed_threshold_critical}
|
||||
EOF
|
||||
|
||||
@ -164,8 +151,8 @@ EOF
|
||||
timeout_h = 0
|
||||
locked = false
|
||||
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
new_host_delay = "${var.new_host_delay}"
|
||||
|
||||
silenced = "${var.scanned_bytes_billed_silenced}"
|
||||
|
||||
@ -189,7 +176,7 @@ resource "datadog_monitor" "available_slots" {
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.available_slots_timeframe}): avg:gcp.bigquery.slots.total_available{${data.template_file.filter.rendered}}
|
||||
avg(${var.available_slots_timeframe}): avg:gcp.bigquery.slots.total_available{${var.filter_tags}}
|
||||
< ${var.available_slots_threshold_critical}
|
||||
EOF
|
||||
|
||||
@ -206,8 +193,8 @@ EOF
|
||||
timeout_h = 0
|
||||
locked = false
|
||||
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
new_host_delay = "${var.new_host_delay}"
|
||||
|
||||
silenced = "${var.available_slots_silenced}"
|
||||
|
||||
@ -231,7 +218,7 @@ resource "datadog_monitor" "stored_bytes" {
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.stored_bytes_timeframe}): avg:gcp.bigquery.storage.stored_bytes{${data.template_file.filter.rendered}}
|
||||
avg(${var.stored_bytes_timeframe}): avg:gcp.bigquery.storage.stored_bytes{${var.filter_tags}}
|
||||
by {dataset_id,table}
|
||||
> ${var.stored_bytes_threshold_critical}
|
||||
EOF
|
||||
@ -249,8 +236,8 @@ EOF
|
||||
timeout_h = 0
|
||||
locked = false
|
||||
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
new_host_delay = "${var.new_host_delay}"
|
||||
|
||||
silenced = "${var.stored_bytes_silenced}"
|
||||
|
||||
@ -274,7 +261,7 @@ resource "datadog_monitor" "table_count" {
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.table_count_timeframe}): avg:gcp.bigquery.storage.table_count{${data.template_file.filter.rendered}}
|
||||
avg(${var.table_count_timeframe}): avg:gcp.bigquery.storage.table_count{${var.filter_tags}}
|
||||
by {dataset_id}
|
||||
> ${var.table_count_threshold_critical}
|
||||
EOF
|
||||
@ -292,8 +279,8 @@ EOF
|
||||
timeout_h = 0
|
||||
locked = false
|
||||
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
new_host_delay = "${var.new_host_delay}"
|
||||
|
||||
silenced = "${var.table_count_silenced}"
|
||||
|
||||
@ -317,7 +304,7 @@ resource "datadog_monitor" "uploaded_bytes" {
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.uploaded_bytes_timeframe}): avg:gcp.bigquery.storage.uploaded_bytes{${data.template_file.filter.rendered}}
|
||||
avg(${var.uploaded_bytes_timeframe}): avg:gcp.bigquery.storage.uploaded_bytes{${var.filter_tags}}
|
||||
by {dataset_id,table}
|
||||
> ${var.uploaded_bytes_threshold_critical}
|
||||
EOF
|
||||
@ -335,8 +322,8 @@ EOF
|
||||
timeout_h = 0
|
||||
locked = false
|
||||
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
new_host_delay = "${var.new_host_delay}"
|
||||
|
||||
silenced = "${var.uploaded_bytes_silenced}"
|
||||
|
||||
@ -360,7 +347,7 @@ resource "datadog_monitor" "uploaded_bytes_billed" {
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.uploaded_bytes_billed_timeframe}): avg:gcp.bigquery.storage.uploaded_bytes{${data.template_file.filter.rendered}}
|
||||
avg(${var.uploaded_bytes_billed_timeframe}): avg:gcp.bigquery.storage.uploaded_bytes{${var.filter_tags}}
|
||||
by {dataset_id,table}
|
||||
> ${var.uploaded_bytes_billed_threshold_critical}
|
||||
EOF
|
||||
@ -378,8 +365,8 @@ EOF
|
||||
timeout_h = 0
|
||||
locked = false
|
||||
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
new_host_delay = "${var.new_host_delay}"
|
||||
|
||||
silenced = "${var.uploaded_bytes_billed_silenced}"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user