# # 4XX Errors # resource "datadog_monitor" "error_rate_4xx" { count = var.error_rate_4xx_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB 4xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.error_rate_4xx_message, var.message) type = "query alert" query = < ${var.error_rate_4xx_threshold_critical} EOQ thresholds = { warning = var.error_rate_4xx_threshold_warning critical = var.error_rate_4xx_threshold_critical } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_audit = false locked = false timeout_h = 0 include_tags = true require_full_window = false notify_no_data = false renotify_interval = 0 tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.error_rate_4xx_extra_tags) } # # 5XX Errors # resource "datadog_monitor" "error_rate_5xx" { count = var.error_rate_5xx_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB 5xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.error_rate_5xx_message, var.message) type = "query alert" query = < ${var.error_rate_5xx_threshold_critical} EOQ thresholds = { warning = var.error_rate_5xx_threshold_warning critical = var.error_rate_5xx_threshold_critical } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_audit = false locked = false timeout_h = 0 include_tags = true require_full_window = false notify_no_data = false renotify_interval = 0 tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.error_rate_5xx_extra_tags) } # # Backend Latency for service # resource "datadog_monitor" "backend_latency_service" { count = var.backend_latency_service_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB service backend latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" message = coalesce(var.backend_latency_service_message, var.message) type = "query alert" query = < ${var.backend_latency_service_threshold_critical} EOQ thresholds = { warning = var.backend_latency_service_threshold_warning critical = var.backend_latency_service_threshold_critical } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_audit = false locked = false timeout_h = 0 include_tags = true require_full_window = false notify_no_data = false renotify_interval = 0 tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.backend_latency_service_extra_tags) } # # Backend Latency for bucket # resource "datadog_monitor" "backend_latency_bucket" { count = var.backend_latency_bucket_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB bucket backend latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" message = coalesce(var.backend_latency_bucket_message, var.message) type = "query alert" query = < ${var.backend_latency_bucket_threshold_critical} EOQ thresholds = { warning = var.backend_latency_bucket_threshold_warning critical = var.backend_latency_bucket_threshold_critical } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_audit = false locked = false timeout_h = 0 include_tags = true require_full_window = false notify_no_data = false renotify_interval = 0 tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.backend_latency_bucket_extra_tags) } # # Request Count # resource "datadog_monitor" "request_count" { count = var.request_count_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB Requests count increased abruptly {{#is_alert}}{{value}}%%{{/is_alert}}{{#is_warning}}{{value}}%%{{/is_warning}}" message = coalesce(var.request_count_message, var.message) type = "query alert" query = < ${var.request_count_threshold_critical} EOQ thresholds = { warning = var.request_count_threshold_warning critical = var.request_count_threshold_critical } evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_audit = false locked = false timeout_h = 0 include_tags = true require_full_window = false notify_no_data = false renotify_interval = 0 tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.request_count_extra_tags) }