From f6d53ff855f954b0ca37dd9b4cfd9171b1f01394 Mon Sep 17 00:00:00 2001 From: Quentin Gibert Date: Wed, 5 Apr 2023 14:28:07 +0200 Subject: [PATCH 1/4] Key vault latency detector: remove critical status --- .../detectors-keyvault.tf | 22 ++++++++--------- .../integration_azure-key-vault/variables.tf | 24 +++++++------------ 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/modules/integration_azure-key-vault/detectors-keyvault.tf b/modules/integration_azure-key-vault/detectors-keyvault.tf index d24c2fde9..2c2f99f6b 100644 --- a/modules/integration_azure-key-vault/detectors-keyvault.tf +++ b/modules/integration_azure-key-vault/detectors-keyvault.tf @@ -51,16 +51,16 @@ resource "signalfx_detector" "api_latency" { program_text = <<-EOF base_filter = filter('resource_type', 'Microsoft.KeyVault/vaults') and filter('primary_aggregation_type', 'true') signal = data('ServiceApiLatency', extrapolation="zero", filter=base_filter and not filter('activityname', 'secretlist') and ${module.filtering.signalflow})${var.api_latency_aggregation_function}.publish('signal') - detect(when(signal > threshold(${var.api_latency_threshold_critical}), lasting="${var.api_latency_lasting_duration_critical}")).publish('CRIT') - detect(when(signal > threshold(${var.api_latency_threshold_major}), lasting="${var.api_latency_lasting_duration_major}") and (not when(signal > ${var.api_latency_threshold_critical}, lasting="${var.api_latency_lasting_duration_critical}"))).publish('MAJOR') + detect(when(signal > threshold(${var.api_latency_threshold_major}), lasting="${var.api_latency_lasting_duration_major}")).publish('MAJOR') + detect(when(signal > threshold(${var.api_latency_threshold_minor}), lasting="${var.api_latency_lasting_duration_minor}") and (not when(signal > ${var.api_latency_threshold_major}, lasting="${var.api_latency_lasting_duration_major}"))).publish('MINOR') EOF rule { - description = "is too high > ${var.api_latency_threshold_critical}ms" - severity = "Critical" - detect_label = "CRIT" + description = "is too high > ${var.api_latency_threshold_major}ms" + severity = "Major" + detect_label = "MAJOR" disabled = coalesce(var.api_latency_disabled_critical, var.api_latency_disabled, var.detectors_disabled) - notifications = try(coalescelist(lookup(var.api_latency_notifications, "critical", []), var.notifications.critical), null) + notifications = try(coalescelist(lookup(var.api_latency_notifications, "major", []), var.notifications.major), null) runbook_url = try(coalesce(var.api_latency_runbook_url, var.runbook_url), "") tip = var.api_latency_tip parameterized_subject = var.message_subject == "" ? local.rule_subject : var.message_subject @@ -68,11 +68,11 @@ resource "signalfx_detector" "api_latency" { } rule { - description = "is too high > ${var.api_latency_threshold_major}ms" - severity = "Major" - detect_label = "MAJOR" - disabled = coalesce(var.api_latency_disabled_major, var.api_latency_disabled, var.detectors_disabled) - notifications = try(coalescelist(lookup(var.api_latency_notifications, "major", []), var.notifications.major), null) + description = "is too high > ${var.api_latency_threshold_minor}ms" + severity = "Minor" + detect_label = "MINOR" + disabled = coalesce(var.api_latency_disabled_minor, var.api_latency_disabled, var.detectors_disabled) + notifications = try(coalescelist(lookup(var.api_latency_notifications, "minor", []), var.notifications.minor), null) runbook_url = try(coalesce(var.api_latency_runbook_url, var.runbook_url), "") tip = var.api_latency_tip parameterized_subject = var.message_subject == "" ? local.rule_subject : var.message_subject diff --git a/modules/integration_azure-key-vault/variables.tf b/modules/integration_azure-key-vault/variables.tf index c4754ff7d..47491b859 100644 --- a/modules/integration_azure-key-vault/variables.tf +++ b/modules/integration_azure-key-vault/variables.tf @@ -100,12 +100,6 @@ variable "api_latency_disabled" { default = null } -variable "api_latency_disabled_critical" { - description = "Disable critical alerting rule for api_latency detector" - type = bool - default = null -} - variable "api_latency_disabled_major" { description = "Disable major alerting rule for api_latency detector" type = bool @@ -124,22 +118,22 @@ variable "api_latency_aggregation_function" { default = ".mean(by=['azure_resource_name', 'azure_resource_group_name', 'azure_region'])" } -variable "api_latency_lasting_duration_critical" { +variable "api_latency_lasting_duration_minor" { description = "Evaluation window for api_latency detector (i.e. 5m, 20m, 1h, 1d)" type = string - default = "1h" -} - -variable "api_latency_threshold_critical" { - description = "Critical threshold for api_latency detector" - type = number - default = 500 + default = "30m" } variable "api_latency_lasting_duration_major" { description = "Evaluation window for api_latency detector (i.e. 5m, 20m, 1h, 1d)" type = string - default = "30m" + default = "1h" +} + +variable "api_latency_threshold_minor" { + description = "Minor threshold for api_latency detector" + type = number + default = 500 } variable "api_latency_threshold_major" { From 40ccdf1d82afe037635e124659796aa15b1528a6 Mon Sep 17 00:00:00 2001 From: Quentin Gibert Date: Wed, 5 Apr 2023 15:55:39 +0200 Subject: [PATCH 2/4] fix errors/docs --- docs/severity.md | 2 +- modules/integration_azure-key-vault/README.md | 2 +- modules/integration_azure-key-vault/detectors-keyvault.tf | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/severity.md b/docs/severity.md index e617b86d6..52be93c87 100644 --- a/docs/severity.md +++ b/docs/severity.md @@ -508,7 +508,7 @@ |Detector|Critical|Major|Minor|Warning|Info| |---|---|---|---|---|---| |Azure Key Vault API result rate|X|X|-|-|-| -|Azure Key Vault API latency|X|X|-|-|-| +|Azure Key Vault API latency|-|X|X|-|-| ## integration_azure-load-balancer diff --git a/modules/integration_azure-key-vault/README.md b/modules/integration_azure-key-vault/README.md index 874a62ef3..dde03013d 100644 --- a/modules/integration_azure-key-vault/README.md +++ b/modules/integration_azure-key-vault/README.md @@ -76,7 +76,7 @@ This module creates the following SignalFx detectors which could contain one or |Detector|Critical|Major|Minor|Warning|Info| |---|---|---|---|---|---| |Azure Key Vault API result rate|X|X|-|-|-| -|Azure Key Vault API latency|X|X|-|-|-| +|Azure Key Vault API latency|-|X|X|-|-| ## How to collect required metrics? diff --git a/modules/integration_azure-key-vault/detectors-keyvault.tf b/modules/integration_azure-key-vault/detectors-keyvault.tf index 2c2f99f6b..e878c8b74 100644 --- a/modules/integration_azure-key-vault/detectors-keyvault.tf +++ b/modules/integration_azure-key-vault/detectors-keyvault.tf @@ -59,7 +59,7 @@ resource "signalfx_detector" "api_latency" { description = "is too high > ${var.api_latency_threshold_major}ms" severity = "Major" detect_label = "MAJOR" - disabled = coalesce(var.api_latency_disabled_critical, var.api_latency_disabled, var.detectors_disabled) + disabled = coalesce(var.api_latency_disabled_major, var.api_latency_disabled, var.detectors_disabled) notifications = try(coalescelist(lookup(var.api_latency_notifications, "major", []), var.notifications.major), null) runbook_url = try(coalesce(var.api_latency_runbook_url, var.runbook_url), "") tip = var.api_latency_tip @@ -71,7 +71,7 @@ resource "signalfx_detector" "api_latency" { description = "is too high > ${var.api_latency_threshold_minor}ms" severity = "Minor" detect_label = "MINOR" - disabled = coalesce(var.api_latency_disabled_minor, var.api_latency_disabled, var.detectors_disabled) + disabled = coalesce(var.api_latency_disabled, var.detectors_disabled) notifications = try(coalescelist(lookup(var.api_latency_notifications, "minor", []), var.notifications.minor), null) runbook_url = try(coalesce(var.api_latency_runbook_url, var.runbook_url), "") tip = var.api_latency_tip From 1268bce039ce67e3dfc1e916399f25e0f0c1cbea Mon Sep 17 00:00:00 2001 From: Quentin Gibert Date: Wed, 5 Apr 2023 16:13:06 +0200 Subject: [PATCH 3/4] adding api_latency_disabled_minor var --- modules/integration_azure-key-vault/detectors-keyvault.tf | 2 +- modules/integration_azure-key-vault/variables.tf | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/integration_azure-key-vault/detectors-keyvault.tf b/modules/integration_azure-key-vault/detectors-keyvault.tf index e878c8b74..c00c84d6c 100644 --- a/modules/integration_azure-key-vault/detectors-keyvault.tf +++ b/modules/integration_azure-key-vault/detectors-keyvault.tf @@ -71,7 +71,7 @@ resource "signalfx_detector" "api_latency" { description = "is too high > ${var.api_latency_threshold_minor}ms" severity = "Minor" detect_label = "MINOR" - disabled = coalesce(var.api_latency_disabled, var.detectors_disabled) + disabled = coalesce(var.api_latency_disabled_minor, var.api_latency_disabled, var.detectors_disabled) notifications = try(coalescelist(lookup(var.api_latency_notifications, "minor", []), var.notifications.minor), null) runbook_url = try(coalesce(var.api_latency_runbook_url, var.runbook_url), "") tip = var.api_latency_tip diff --git a/modules/integration_azure-key-vault/variables.tf b/modules/integration_azure-key-vault/variables.tf index 47491b859..52acc995a 100644 --- a/modules/integration_azure-key-vault/variables.tf +++ b/modules/integration_azure-key-vault/variables.tf @@ -100,6 +100,12 @@ variable "api_latency_disabled" { default = null } +variable "api_latency_disabled_minor" { + description = "Disable major alerting rule for api_latency detector" + type = bool + default = null +} + variable "api_latency_disabled_major" { description = "Disable major alerting rule for api_latency detector" type = bool From 0378005dc98a36aa6d86a1ee837e3daa56558355 Mon Sep 17 00:00:00 2001 From: Quentin Gibert Date: Wed, 5 Apr 2023 16:25:14 +0200 Subject: [PATCH 4/4] fix typo in var description --- modules/integration_azure-key-vault/variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/integration_azure-key-vault/variables.tf b/modules/integration_azure-key-vault/variables.tf index 52acc995a..4675bede2 100644 --- a/modules/integration_azure-key-vault/variables.tf +++ b/modules/integration_azure-key-vault/variables.tf @@ -101,7 +101,7 @@ variable "api_latency_disabled" { } variable "api_latency_disabled_minor" { - description = "Disable major alerting rule for api_latency detector" + description = "Disable minor alerting rule for api_latency detector" type = bool default = null }