From fb93704b17f8b64060503a40b2938ca1e9a9a719 Mon Sep 17 00:00:00 2001 From: Rafael Romero Carmona Date: Mon, 13 Aug 2018 16:39:46 +0200 Subject: [PATCH] MON-227 Standardize filters and split delays --- cloud/gcp/lb/README.md | 7 +++--- cloud/gcp/lb/inputs.tf | 20 +++++----------- cloud/gcp/lb/monitors-lb.tf | 47 ++++++++++++++----------------------- 3 files changed, 26 insertions(+), 48 deletions(-) diff --git a/cloud/gcp/lb/README.md b/cloud/gcp/lb/README.md index 8a987f0..9551d90 100644 --- a/cloud/gcp/lb/README.md +++ b/cloud/gcp/lb/README.md @@ -33,7 +33,6 @@ Creates DataDog monitors with the following checks: | backend_latency_threshold_warning | Latency in seconds (warning threshold) | string | `2000` | no | | backend_latency_time_aggregator | Timeframe for the GCP LB Backend Latency monitor | string | `min` | no | | backend_latency_timeframe | Timeframe for the GCP LB Backend Latency monitor | string | `last_10m` | no | -| delay | Delay in seconds for the metric evaluation | string | `900` | no | | environment | Architecture environment | string | - | yes | | error_rate_4xx_artificial_request | Divisor Delta for the GCP LB 4XX Errors monitor | string | `5` | no | | error_rate_4xx_extra_tags | Extra tags for GCP LB 4XX Errors monitor | list | `` | no | @@ -49,8 +48,8 @@ Creates DataDog monitors with the following checks: | error_rate_5xx_threshold_critical | Rate error in percentage (critical threshold) | string | `50` | no | | error_rate_5xx_time_aggregator | Timeframe for the GCP LB 5XX Errors monitor | string | `sum` | no | | error_rate_5xx_timeframe | Timeframe for the GCP LB 5XX Errors 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 | +| evaluation_delay | Delay in seconds for the metric evaluation | string | `900` | no | +| filter_tags | Tags used for filtering | string | `*` | no | | latency_extra_tags | Extra tags for GCP LB Latency monitor | list | `` | no | | latency_message | Custom message for the GCP LB Latency monitor | string | `` | no | | latency_silenced | Groups to mute for GCP LB Latency monitor | map | `` | no | @@ -59,7 +58,7 @@ Creates DataDog monitors with the following checks: | latency_time_aggregator | Timeframe for the GCP LB Latency monitor | string | `min` | no | | latency_timeframe | Timeframe for the GCP LB Latency monitor | string | `last_10m` | 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 | | request_count_extra_tags | Extra tags for GCP LB Request Count monitor | list | `` | no | | request_count_message | Custom message for the GCP LB Request Count monitor | string | `` | no | | request_count_silenced | Groups to mute for GCP LB Request Count monitor | map | `` | no | diff --git a/cloud/gcp/lb/inputs.tf b/cloud/gcp/lb/inputs.tf index 88d8f0f..3c3d758 100644 --- a/cloud/gcp/lb/inputs.tf +++ b/cloud/gcp/lb/inputs.tf @@ -6,13 +6,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 = "*" } @@ -20,17 +15,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 } # diff --git a/cloud/gcp/lb/monitors-lb.tf b/cloud/gcp/lb/monitors-lb.tf index a2601d3..e306d20 100644 --- a/cloud/gcp/lb/monitors-lb.tf +++ b/cloud/gcp/lb/monitors-lb.tf @@ -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}"}" - } -} - # # 4XX Errors # @@ -22,9 +9,9 @@ resource "datadog_monitor" "error_rate_4xx" { query = < ${var.error_rate_4xx_threshold_critical} EOF @@ -40,8 +27,8 @@ EOF notify_no_data = false renotify_interval = 0 - evaluation_delay = "${var.delay}" - new_host_delay = "${var.delay}" + evaluation_delay = "${var.evaluation_delay}" + new_host_delay = "${var.new_host_delay}" silenced = "${var.error_rate_4xx_silenced}" @@ -66,9 +53,9 @@ resource "datadog_monitor" "error_rate_5xx" { query = < ${var.error_rate_5xx_threshold_critical} EOF @@ -84,8 +71,8 @@ EOF notify_no_data = false renotify_interval = 0 - evaluation_delay = "${var.delay}" - new_host_delay = "${var.delay}" + evaluation_delay = "${var.evaluation_delay}" + new_host_delay = "${var.new_host_delay}" silenced = "${var.error_rate_5xx_silenced}" @@ -110,7 +97,7 @@ resource "datadog_monitor" "latency" { query = < ${var.latency_threshold_critical} EOF @@ -127,8 +114,8 @@ EOF notify_no_data = false renotify_interval = 0 - evaluation_delay = "${var.delay}" - new_host_delay = "${var.delay}" + evaluation_delay = "${var.evaluation_delay}" + new_host_delay = "${var.new_host_delay}" silenced = "${var.latency_silenced}" @@ -153,7 +140,7 @@ resource "datadog_monitor" "backend_latency" { query = < ${var.backend_latency_threshold_critical} EOF @@ -170,8 +157,8 @@ EOF notify_no_data = false renotify_interval = 0 - evaluation_delay = "${var.delay}" - new_host_delay = "${var.delay}" + evaluation_delay = "${var.evaluation_delay}" + new_host_delay = "${var.new_host_delay}" silenced = "${var.backend_latency_silenced}" @@ -196,7 +183,7 @@ resource "datadog_monitor" "request_count" { query = < ${var.request_count_threshold_critical} EOF @@ -213,8 +200,8 @@ EOF notify_no_data = false renotify_interval = 0 - evaluation_delay = "${var.delay}" - new_host_delay = "${var.delay}" + evaluation_delay = "${var.evaluation_delay}" + new_host_delay = "${var.new_host_delay}" silenced = "${var.request_count_silenced}"