-
Notifications
You must be signed in to change notification settings - Fork 5
/
custom-metrics.tf
30 lines (26 loc) · 1.34 KB
/
custom-metrics.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
locals {
custom_metrics_filter = var.custom_metrics_filter_override != "" ? var.custom_metrics_filter_override : var.filter_str
custom_metrics_notification_channel = var.custom_metrics_alerting_enabled ? var.notification_channel : ""
}
module "custom_metrics" {
source = "kabisa/generic-monitor/datadog"
version = "1.0.0"
name = "Estimated Custom Metrics Usage"
query = "avg(${var.custom_metrics_evaluation_period}):sum:datadog.estimated_usage.metrics.custom{${local.custom_metrics_filter}} > ${var.custom_metrics_critical}"
alert_message = "The Plan specified {{threshold}} Custom Metrics. The current estimate ({{value}}) exceeds the plan"
recovery_message = "Count of Monitored Custom Metrics has recovered"
# monitor level vars
enabled = var.custom_metrics_enabled
alerting_enabled = var.custom_metrics_alerting_enabled
critical_threshold = var.custom_metrics_critical
warning_threshold = var.custom_metrics_warning
priority = var.custom_metrics_priority
docs = var.custom_metrics_docs
note = var.custom_metrics_note
# module level vars
env = var.env
service = var.service
notification_channel = var.notification_channel
additional_tags = var.additional_tags
locked = var.locked
}