MON-391 Monitors for Azure Search
This commit is contained in:
parent
819dc38a07
commit
3042f21daf
@ -98,6 +98,7 @@ The `//` is very important, it's a terraform specific syntax used to separate gi
|
||||
- [azure](https://git.fr.clara.net/claranet/cloudnative/projects/datadog/terraform/monitors/tree/master/cloud/azure/)
|
||||
- [apimanagement](https://git.fr.clara.net/claranet/cloudnative/projects/datadog/terraform/monitors/tree/master/cloud/azure/apimanagement/)
|
||||
- [app-services](https://git.fr.clara.net/claranet/cloudnative/projects/datadog/terraform/monitors/tree/master/cloud/azure/app-services/)
|
||||
- [azure-search](https://git.fr.clara.net/claranet/cloudnative/projects/datadog/terraform/monitors/tree/master/cloud/azure/azure-search/)
|
||||
- [cosmosdb](https://git.fr.clara.net/claranet/cloudnative/projects/datadog/terraform/monitors/tree/master/cloud/azure/cosmosdb/)
|
||||
- [datalakestore](https://git.fr.clara.net/claranet/cloudnative/projects/datadog/terraform/monitors/tree/master/cloud/azure/datalakestore/)
|
||||
- [eventhub](https://git.fr.clara.net/claranet/cloudnative/projects/datadog/terraform/monitors/tree/master/cloud/azure/eventhub/)
|
||||
|
||||
62
cloud/azure/azure-search/README.md
Normal file
62
cloud/azure/azure-search/README.md
Normal file
@ -0,0 +1,62 @@
|
||||
# CLOUD AZURE AZURE-SEARCH DataDog monitors
|
||||
|
||||
## How to use this module
|
||||
|
||||
```
|
||||
module "datadog-monitors-cloud-azure-azure-search" {
|
||||
source = "git::ssh://git@git.fr.clara.net/claranet/cloudnative/projects/datadog/terraform/monitors.git//cloud/azure/azure-search?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- Azure Search latency too high
|
||||
- Azure Search throttled queries rate is too high
|
||||
## Inputs
|
||||
|
||||
| Name | Description | Type | Default | Required |
|
||||
|------|-------------|:----:|:-----:|:-----:|
|
||||
| environment | Architecture environment | string | n/a | yes |
|
||||
| evaluation\_delay | Delay in seconds for the metric evaluation | string | `"900"` | no |
|
||||
| filter\_tags\_custom | Tags used for custom filtering when filter_tags_use_defaults is false | string | `"*"` | no |
|
||||
| filter\_tags\_custom\_excluded | Tags excluded for custom filtering when filter_tags_use_defaults is false | string | `""` | no |
|
||||
| filter\_tags\_use\_defaults | Use default filter tags convention | string | `"true"` | no |
|
||||
| latency\_enabled | Flag to enable Azure Search latency monitor | string | `"true"` | no |
|
||||
| latency\_extra\_tags | Extra tags for Azure Search latency monitor | list | `[]` | no |
|
||||
| latency\_message | Custom message for Azure Search latency monitor | string | `""` | no |
|
||||
| latency\_silenced | Groups to mute for Azure Search latency monitor | map | `{}` | no |
|
||||
| latency\_threshold\_critical | Alerting threshold for Azure Search latency in seconds | string | `"4"` | no |
|
||||
| latency\_threshold\_warning | Warning threshold for Azure Search latency in seconds | string | `"2"` | no |
|
||||
| latency\_time\_aggregator | Monitor aggregator for Azure Search latency [available values: min, max or avg] | string | `"min"` | no |
|
||||
| latency\_timeframe | Monitor timeframe for Azure Search latency [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `"last_5m"` | no |
|
||||
| message | Message sent when a monitor is triggered | string | n/a | yes |
|
||||
| new\_host\_delay | Delay in seconds before monitor new resource | string | `"300"` | no |
|
||||
| throttled\_queries\_rate\_enabled | Flag to enable Azure Search throttled queries rate monitor | string | `"true"` | no |
|
||||
| throttled\_queries\_rate\_extra\_tags | Extra tags for Azure Search throttled queries rate monitor | list | `[]` | no |
|
||||
| throttled\_queries\_rate\_message | Custom message for Azure Search throttled queries rate monitor | string | `""` | no |
|
||||
| throttled\_queries\_rate\_silenced | Groups to mute for Azure Search throttled queries rate monitor | map | `{}` | no |
|
||||
| throttled\_queries\_rate\_threshold\_critical | Alerting threshold for Azure Search throttled queries rate | string | `"50"` | no |
|
||||
| throttled\_queries\_rate\_threshold\_warning | Warning threshold for Azure Search throttled queries rate | string | `"25"` | no |
|
||||
| throttled\_queries\_rate\_time\_aggregator | Monitor aggregator for Azure Search throttled queries rate [available values: min, max or avg] | string | `"min"` | no |
|
||||
| throttled\_queries\_rate\_timeframe | Monitor timeframe for Azure Search throttled queries rate [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `"last_5m"` | no |
|
||||
|
||||
## Outputs
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
| azure\_search\_latency\_id | id for monitor azure_search_latency |
|
||||
| azure\_search\_throttled\_queries\_rate\_id | id for monitor azure_search_throttled_queries_rate |
|
||||
|
||||
## Related documentation
|
||||
|
||||
DataDog documentation: [https://docs.datadoghq.com/integrations/azure_app_services](https://docs.datadoghq.com/integrations/azure_app_services)
|
||||
|
||||
Azure Documentation [https://docs.microsoft.com/en-us/azure/search/search-monitor-usage](https://docs.microsoft.com/en-us/azure/search/search-monitor-usage)
|
||||
|
||||
Azure monitor metrics [https://docs.microsoft.com/en-us/azure/azure-monitor/platform/metrics-supported#microsoftsearchsearchservices](https://docs.microsoft.com/en-us/azure/azure-monitor/platform/metrics-supported#microsoftsearchsearchservices)
|
||||
126
cloud/azure/azure-search/inputs.tf
Normal file
126
cloud/azure/azure-search/inputs.tf
Normal file
@ -0,0 +1,126 @@
|
||||
variable "environment" {
|
||||
description = "Architecture 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"
|
||||
default = "*"
|
||||
}
|
||||
|
||||
variable "filter_tags_custom_excluded" {
|
||||
description = "Tags excluded for custom filtering when filter_tags_use_defaults is false"
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "message" {
|
||||
description = "Message sent when a monitor is triggered"
|
||||
}
|
||||
|
||||
variable "evaluation_delay" {
|
||||
description = "Delay in seconds for the metric evaluation"
|
||||
default = 900
|
||||
}
|
||||
|
||||
variable "new_host_delay" {
|
||||
description = "Delay in seconds before monitor new resource"
|
||||
default = 300
|
||||
}
|
||||
|
||||
# Azure Search specific variables
|
||||
variable "latency_silenced" {
|
||||
description = "Groups to mute for Azure Search latency monitor"
|
||||
type = "map"
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "latency_enabled" {
|
||||
description = "Flag to enable Azure Search latency monitor"
|
||||
type = "string"
|
||||
default = "true"
|
||||
}
|
||||
|
||||
variable "latency_extra_tags" {
|
||||
description = "Extra tags for Azure Search latency monitor"
|
||||
type = "list"
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "latency_message" {
|
||||
description = "Custom message for Azure Search latency monitor"
|
||||
type = "string"
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "latency_time_aggregator" {
|
||||
description = "Monitor aggregator for Azure Search latency [available values: min, max or avg]"
|
||||
type = "string"
|
||||
default = "min"
|
||||
}
|
||||
|
||||
variable "latency_timeframe" {
|
||||
description = "Monitor timeframe for Azure Search latency [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]"
|
||||
type = "string"
|
||||
default = "last_5m"
|
||||
}
|
||||
|
||||
variable "latency_threshold_critical" {
|
||||
default = 4
|
||||
description = "Alerting threshold for Azure Search latency in seconds"
|
||||
}
|
||||
|
||||
variable "latency_threshold_warning" {
|
||||
default = 2
|
||||
description = "Warning threshold for Azure Search latency in seconds"
|
||||
}
|
||||
|
||||
variable "throttled_queries_rate_silenced" {
|
||||
description = "Groups to mute for Azure Search throttled queries rate monitor"
|
||||
type = "map"
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "throttled_queries_rate_enabled" {
|
||||
description = "Flag to enable Azure Search throttled queries rate monitor"
|
||||
type = "string"
|
||||
default = "true"
|
||||
}
|
||||
|
||||
variable "throttled_queries_rate_extra_tags" {
|
||||
description = "Extra tags for Azure Search throttled queries rate monitor"
|
||||
type = "list"
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "throttled_queries_rate_message" {
|
||||
description = "Custom message for Azure Search throttled queries rate monitor"
|
||||
type = "string"
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "throttled_queries_rate_time_aggregator" {
|
||||
description = "Monitor aggregator for Azure Search throttled queries rate [available values: min, max or avg]"
|
||||
type = "string"
|
||||
default = "min"
|
||||
}
|
||||
|
||||
variable "throttled_queries_rate_timeframe" {
|
||||
description = "Monitor timeframe for Azure Search throttled queries rate [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]"
|
||||
type = "string"
|
||||
default = "last_5m"
|
||||
}
|
||||
|
||||
variable "throttled_queries_rate_threshold_critical" {
|
||||
default = 50
|
||||
description = "Alerting threshold for Azure Search throttled queries rate"
|
||||
}
|
||||
|
||||
variable "throttled_queries_rate_threshold_warning" {
|
||||
default = 25
|
||||
description = "Warning threshold for Azure Search throttled queries rate"
|
||||
}
|
||||
9
cloud/azure/azure-search/modules.tf
Normal file
9
cloud/azure/azure-search/modules.tf
Normal file
@ -0,0 +1,9 @@
|
||||
module "filter-tags" {
|
||||
source = "../../../common/filter-tags"
|
||||
|
||||
environment = "${var.environment}"
|
||||
resource = "azure_search"
|
||||
filter_tags_use_defaults = "${var.filter_tags_use_defaults}"
|
||||
filter_tags_custom = "${var.filter_tags_custom}"
|
||||
filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}"
|
||||
}
|
||||
63
cloud/azure/azure-search/monitors-azure-search.tf
Normal file
63
cloud/azure/azure-search/monitors-azure-search.tf
Normal file
@ -0,0 +1,63 @@
|
||||
# Monitoring Azure Search latency
|
||||
resource "datadog_monitor" "azure_search_latency" {
|
||||
count = "${var.latency_enabled ? 1 : 0}"
|
||||
name = "[${var.environment}] Azure Search latency too high {{#is_alert}}{{{comparator}}} {{threshold}}s ({{value}}s){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}s ({{value}}s){{/is_warning}}"
|
||||
type = "metric alert"
|
||||
message = "${coalesce(var.latency_message, var.message)}"
|
||||
|
||||
query = <<EOF
|
||||
${var.latency_time_aggregator}(${var.latency_timeframe}): (
|
||||
avg:azure.search_searchservices.search_latency${module.filter-tags.query_alert} by {resource_group,region,name}
|
||||
) > ${var.latency_threshold_critical}
|
||||
EOF
|
||||
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
new_host_delay = "${var.new_host_delay}"
|
||||
|
||||
thresholds {
|
||||
warning = "${var.latency_threshold_warning}"
|
||||
critical = "${var.latency_threshold_critical}"
|
||||
}
|
||||
|
||||
silenced = "${var.latency_silenced}"
|
||||
|
||||
notify_no_data = true # Will notify when no data is received
|
||||
renotify_interval = 0
|
||||
require_full_window = false
|
||||
timeout_h = 0
|
||||
include_tags = true
|
||||
|
||||
tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure-search", "team:claranet", "created-by:terraform", "${var.latency_extra_tags}"]
|
||||
}
|
||||
|
||||
# Monitoring Azure Search throttled queries
|
||||
resource "datadog_monitor" "azure_search_throttled_queries_rate" {
|
||||
count = "${var.throttled_queries_rate_enabled ? 1 : 0}"
|
||||
name = "[${var.environment}] Azure Search throttled queries rate is too high {{#is_alert}}{{{comparator}}} {{threshold}}s ({{value}}s){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}s ({{value}}s){{/is_warning}}"
|
||||
type = "metric alert"
|
||||
message = "${coalesce(var.throttled_queries_rate_message, var.message)}"
|
||||
|
||||
query = <<EOF
|
||||
${var.throttled_queries_rate_time_aggregator}(${var.throttled_queries_rate_timeframe}): (
|
||||
avg:azure.search_searchservices.throttled_search_queries_percentage${module.filter-tags.query_alert} by {resource_group,region,name}
|
||||
) > ${var.throttled_queries_rate_threshold_critical}
|
||||
EOF
|
||||
|
||||
evaluation_delay = "${var.evaluation_delay}"
|
||||
new_host_delay = "${var.new_host_delay}"
|
||||
|
||||
thresholds {
|
||||
warning = "${var.throttled_queries_rate_threshold_warning}"
|
||||
critical = "${var.throttled_queries_rate_threshold_critical}"
|
||||
}
|
||||
|
||||
silenced = "${var.throttled_queries_rate_silenced}"
|
||||
|
||||
notify_no_data = true # Will notify when no data is received
|
||||
renotify_interval = 0
|
||||
require_full_window = false
|
||||
timeout_h = 0
|
||||
include_tags = true
|
||||
|
||||
tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure-search", "team:claranet", "created-by:terraform", "${var.throttled_queries_rate_extra_tags}"]
|
||||
}
|
||||
9
cloud/azure/azure-search/outputs.tf
Normal file
9
cloud/azure/azure-search/outputs.tf
Normal file
@ -0,0 +1,9 @@
|
||||
output "azure_search_latency_id" {
|
||||
description = "id for monitor azure_search_latency"
|
||||
value = "${datadog_monitor.azure_search_latency.*.id}"
|
||||
}
|
||||
|
||||
output "azure_search_throttled_queries_rate_id" {
|
||||
description = "id for monitor azure_search_throttled_queries_rate"
|
||||
value = "${datadog_monitor.azure_search_throttled_queries_rate.*.id}"
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user