From aa57c19f0384ac1e4e2ea6497b2398741d684381 Mon Sep 17 00:00:00 2001 From: Rafael Romero Carmona Date: Thu, 5 Jul 2018 15:49:09 +0200 Subject: [PATCH] MON-230 Extra tags added for all monitors --- cloud/gcp/big-query/README.md | 17 ++++++++---- cloud/gcp/big-query/scanned_bytes.tf | 7 +++++ cloud/gcp/big-query/scanned_bytes_billed.tf | 7 +++++ cloud/gcp/big-query/slots.tf | 29 ++++++++++++-------- cloud/gcp/big-query/storage.tf | 7 +++++ cloud/gcp/big-query/table_count.tf | 7 +++++ cloud/gcp/big-query/uploaded_bytes.tf | 7 +++++ cloud/gcp/big-query/uploaded_bytes_billed.tf | 9 +++++- 8 files changed, 73 insertions(+), 17 deletions(-) diff --git a/cloud/gcp/big-query/README.md b/cloud/gcp/big-query/README.md index ba831fb..b949786 100644 --- a/cloud/gcp/big-query/README.md +++ b/cloud/gcp/big-query/README.md @@ -44,6 +44,12 @@ Inputs | Name | Description | Type | Default | Required | |------|-------------|:----:|:-----:|:-----:| +| available_slots_extra_tags | Extra tags for GCP Big Query Available Slots monitor | list | `` | no | +| available_slots_message | Custom message for the Available Slots monitor | string | `` | no | +| available_slots_silenced | Groups to mute for GCP Big Query Available Slots monitor. | map | `` | no | +| available_slots_threshold_critical | Available Slots (critical threshold) | string | `200` | no | +| available_slots_threshold_warning | Available Slots (warning threshold) | string | `300` | no | +| available_slots_timeframe | Timeframe for the Available Slots monitor | string | `last_5m` | no | | concurrent_queries_message | Custom message for the Concurrent Queries monitor | string | `` | no | | concurrent_queries_silenced | Groups to mute for GCP Big Query Concurrent Queries monitor | map | `` | no | | concurrent_queries_threshold_critical | Concurrent Queries (critical threshold) (hard limit 50) | string | `45` | no | @@ -60,36 +66,37 @@ Inputs | filter_tags_use_defaults | Use default filter tags convention | string | `true` | no | | message | Message sent when a monitor is triggered | string | - | yes | | project_id | ID of the GCP Project | string | - | yes | +| scanned_bytes_billed_extra_tags | Extra tags for GCP Big Query Scanned Bytes Billed monitor | 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 | `` | no | | scanned_bytes_billed_threshold_critical | Scanned Bytes Billed Bytes (critical threshold) | string | `1` | no | | scanned_bytes_billed_threshold_warning | Scanned Bytes Billed Bytes (warning threshold) | string | `0` | no | | scanned_bytes_billed_timeframe | Timeframe for the Scanned Bytes Billed monitor | string | `last_4h` | no | +| scanned_bytes_extra_tags | Extra tags for GCP Big Query Scanned Bytes monitor | list | `` | no | | scanned_bytes_message | Custom message for the Scanned Bytes monitor | string | `` | no | | scanned_bytes_silenced | Groups to mute for GCP Big Query Scanned Bytes monitor. Muted by default. | map | `` | no | | scanned_bytes_threshold_critical | Scanned Bytes Bytes (critical threshold) | string | `1` | no | | scanned_bytes_threshold_warning | Scanned Bytes Bytes (warning threshold) | string | `0` | no | | scanned_bytes_timeframe | Timeframe for the Scanned Bytes monitor | string | `last_4h` | no | -| slots_available_message | Custom message for the Available Slots monitor | string | `` | no | -| slots_available_silenced | Groups to mute for GCP Big Query Available Slots monitor. | map | `` | no | -| slots_available_threshold_critical | Available Slots (critical threshold) | string | `200` | no | -| slots_available_threshold_warning | Available Slots (warning threshold) | string | `300` | no | -| slots_available_timeframe | Timeframe for the Available Slots monitor | string | `last_5m` | no | +| stored_bytes_extra_tags | Extra tags for GCP Big Query Stored Bytes monitor | list | `` | no | | stored_bytes_message | Custom message for the Stored Bytes monitor | string | `` | no | | stored_bytes_silenced | Groups to mute for GCP Big Query Stored Bytes monitor. Muted by default. | map | `` | no | | stored_bytes_threshold_critical | Stored Bytes in fraction (critical threshold) | string | `1` | no | | stored_bytes_threshold_warning | Stored Bytes in fraction (warning threshold) | string | `0` | no | | stored_bytes_timeframe | Timeframe for the Stored Bytes monitor | string | `last_5m` | no | +| table_count_extra_tags | Extra tags for GCP Big Query Table Count monitor | list | `` | no | | table_count_message | Custom message for the Table Count monitor | string | `` | no | | table_count_silenced | Groups to mute for GCP Big Query Table Count monitor. Muted by default. | map | `` | no | | table_count_threshold_critical | Table Count (critical threshold) | string | `1` | no | | table_count_threshold_warning | Table Count (warning threshold) | string | `0` | no | | table_count_timeframe | Timeframe for the Table Count monitor | string | `last_4h` | no | +| uploaded_bytes_billed_extra_tags | Extra tags for GCP Big Query Scanned Bytes monitor | list | `` | no | | uploaded_bytes_billed_message | Custom message for the Uploaded Bytes Billed monitor | string | `` | no | | uploaded_bytes_billed_silenced | Groups to mute for GCP Big Query Uploaded Bytes Billed monitor. Muted by default. | map | `` | no | | uploaded_bytes_billed_threshold_critical | Uploaded Bytes Billed in Bytes (critical threshold) | string | `1` | no | | uploaded_bytes_billed_threshold_warning | Uploaded Bytes Billed in Bytes (warning threshold) | string | `0` | no | | uploaded_bytes_billed_timeframe | Timeframe for the Uploaded Bytes Billed monitor | string | `last_4h` | no | +| uploaded_bytes_extra_tags | Extra tags for GCP Big Query Uploaded Bytes monitor | list | `` | no | | uploaded_bytes_message | Custom message for the Uploaded Bytes monitor | string | `` | no | | uploaded_bytes_silenced | Groups to mute for GCP Big Query Uploaded Bytes monitor. Muted by default. | map | `` | no | | uploaded_bytes_threshold_critical | Uploaded Bytes in Bytes (critical threshold) | string | `1` | no | diff --git a/cloud/gcp/big-query/scanned_bytes.tf b/cloud/gcp/big-query/scanned_bytes.tf index f660142..00e284e 100644 --- a/cloud/gcp/big-query/scanned_bytes.tf +++ b/cloud/gcp/big-query/scanned_bytes.tf @@ -34,6 +34,12 @@ variable "scanned_bytes_silenced" { } } +variable "scanned_bytes_extra_tags" { + description = "Extra tags for GCP Big Query Scanned Bytes monitor" + type = "list" + default = [] +} + resource "datadog_monitor" "scanned_bytes" { name = "[${var.environment}] GCP Big Query Scanned Bytes too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.scanned_bytes_message, var.message)}" @@ -66,5 +72,6 @@ EOF "provider:gcp", "env:${var.environment}", "resource:big-query", + "${var.scanned_bytes_extra_tags}", ] } diff --git a/cloud/gcp/big-query/scanned_bytes_billed.tf b/cloud/gcp/big-query/scanned_bytes_billed.tf index 8e7fd1a..749999d 100644 --- a/cloud/gcp/big-query/scanned_bytes_billed.tf +++ b/cloud/gcp/big-query/scanned_bytes_billed.tf @@ -34,6 +34,12 @@ variable "scanned_bytes_billed_silenced" { } } +variable "scanned_bytes_billed_extra_tags" { + description = "Extra tags for GCP Big Query Scanned Bytes Billed monitor" + type = "list" + default = [] +} + resource "datadog_monitor" "scanned_bytes_billed" { name = "[${var.environment}] GCP Big Query Scanned Bytes Billed too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.scanned_bytes_billed_message, var.message)}" @@ -66,5 +72,6 @@ EOF "provider:gcp", "env:${var.environment}", "resource:big-query", + "${var.scanned_bytes_billed_extra_tags}", ] } diff --git a/cloud/gcp/big-query/slots.tf b/cloud/gcp/big-query/slots.tf index e41ba80..0a8c22d 100644 --- a/cloud/gcp/big-query/slots.tf +++ b/cloud/gcp/big-query/slots.tf @@ -1,50 +1,56 @@ # # Available Slots # -variable "slots_available_message" { +variable "available_slots_message" { description = "Custom message for the Available Slots monitor" type = "string" default = "" } -variable "slots_available_timeframe" { +variable "available_slots_timeframe" { description = "Timeframe for the Available Slots monitor" type = "string" default = "last_5m" } -variable "slots_available_threshold_warning" { +variable "available_slots_threshold_warning" { description = "Available Slots (warning threshold)" type = "string" default = 300 } -variable "slots_available_threshold_critical" { +variable "available_slots_threshold_critical" { description = "Available Slots (critical threshold)" type = "string" default = 200 } -variable "slots_available_silenced" { +variable "available_slots_silenced" { description = "Groups to mute for GCP Big Query Available Slots monitor." type = "map" default = {} } +variable "available_slots_extra_tags" { + description = "Extra tags for GCP Big Query Available Slots monitor" + type = "list" + default = [] +} + resource "datadog_monitor" "available_slots" { name = "[${var.environment}] GCP Big Query Available Slots close to the limit {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.slots_available_message, var.message)}" + message = "${coalesce(var.available_slots_message, var.message)}" type = "metric alert" query = <