File tree Expand file tree Collapse file tree
infrastructure/terraform/modules/alarms Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ resource "aws_cloudwatch_metric_alarm" "five_xx" {
2+ alarm_name = " ${ var . alarm_prefix } -apigw-5xx"
3+ alarm_description = " RELIABILITY: API Gateway 5xx responses"
4+
5+ namespace = " AWS/ApiGateway"
6+ metric_name = " 5XXError"
7+ statistic = " Sum"
8+ period = var. error_5xx_period_seconds
9+
10+ evaluation_periods = var. error_5xx_evaluation_periods
11+ threshold = var. error_5xx_threshold
12+ comparison_operator = " GreaterThanThreshold"
13+ treat_missing_data = " notBreaching"
14+
15+ dimensions = local. api_dimensions
16+
17+ actions_enabled = false
18+ alarm_actions = []
19+ ok_actions = []
20+ insufficient_data_actions = []
21+ tags = var. tags
22+ }
Original file line number Diff line number Diff line change 1+ resource "aws_cloudwatch_metric_alarm" "latency_anomaly" {
2+ alarm_name = " ${ var . alarm_prefix } -apigw-latency-anomaly"
3+ alarm_description = " RELIABILITY: API Gateway latency anomaly"
4+ comparison_operator = " GreaterThanUpperThreshold"
5+ evaluation_periods = var. latency_evaluation_periods
6+ datapoints_to_alarm = var. latency_datapoints_to_alarm
7+ threshold_metric_id = " ad1"
8+ treat_missing_data = " notBreaching"
9+
10+ actions_enabled = false
11+ alarm_actions = []
12+ ok_actions = []
13+ insufficient_data_actions = []
14+ tags = var. tags
15+
16+ metric_query {
17+ id = " m1"
18+ metric {
19+ metric_name = " Latency"
20+ namespace = " AWS/ApiGateway"
21+ stat = " Average"
22+ period = var. latency_period_seconds
23+ dimensions = local. api_dimensions
24+ }
25+ return_data = true
26+ }
27+
28+ metric_query {
29+ id = " ad1"
30+ expression = " ANOMALY_DETECTION_BAND(m1, ${ var . latency_anomaly_sensitivity } )"
31+ label = " Latency (expected)"
32+ return_data = true
33+ }
34+ }
Original file line number Diff line number Diff line change 1+ resource "aws_cloudwatch_metric_alarm" "latency_threshold" {
2+ alarm_name = " ${ var . alarm_prefix } -apigw-latency-threshold"
3+ alarm_description = " RELIABILITY: API Gateway latency above threshold"
4+
5+ namespace = " AWS/ApiGateway"
6+ metric_name = " Latency"
7+ statistic = " Average"
8+ period = var. latency_period_seconds
9+
10+ evaluation_periods = var. latency_evaluation_periods
11+ threshold = var. latency_threshold_ms
12+ comparison_operator = " GreaterThanThreshold"
13+ treat_missing_data = " notBreaching"
14+
15+ dimensions = local. api_dimensions
16+
17+ actions_enabled = false
18+ alarm_actions = []
19+ ok_actions = []
20+ insufficient_data_actions = []
21+ tags = var. tags
22+ }
Original file line number Diff line number Diff line change 1+ locals {
2+ api_dimensions = {
3+ ApiName = var.api_name
4+ Stage = var.stage_name
5+ }
6+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ resource "aws_cloudwatch_metric_alarm" "read_throttle" {
2+ alarm_name = " ${ var . alarm_prefix } -ddb-${ var . table_name } -read-throttle"
3+ alarm_description = " RELIABILITY: DynamoDB read throttling"
4+
5+ namespace = " AWS/DynamoDB"
6+ metric_name = " ReadThrottleEvents"
7+ statistic = " Sum"
8+ period = var. period_seconds
9+
10+ evaluation_periods = var. evaluation_periods
11+ threshold = var. read_throttle_threshold
12+ comparison_operator = " GreaterThanThreshold"
13+ treat_missing_data = " notBreaching"
14+
15+ dimensions = { TableName = var.table_name }
16+
17+ actions_enabled = false
18+ alarm_actions = []
19+ ok_actions = []
20+ insufficient_data_actions = []
21+ tags = var. tags
22+ }
Original file line number Diff line number Diff line change 1- resource "aws_cloudwatch_metric_alarm" "read_throttle" {
2- alarm_name = " ${ var . alarm_prefix } -ddb-${ var . table_name } -read-throttle"
3- alarm_description = " RELIABILITY: DynamoDB read throttling"
4-
5- namespace = " AWS/DynamoDB"
6- metric_name = " ReadThrottleEvents"
7- statistic = " Sum"
8- period = var. period_seconds
9-
10- evaluation_periods = var. evaluation_periods
11- threshold = var. read_throttle_threshold
12- comparison_operator = " GreaterThanThreshold"
13- treat_missing_data = " notBreaching"
14-
15- dimensions = { TableName = var.table_name }
16-
17- actions_enabled = false
18- alarm_actions = []
19- ok_actions = []
20- insufficient_data_actions = []
21- tags = var. tags
22- }
23-
241resource "aws_cloudwatch_metric_alarm" "write_throttle" {
252 alarm_name = " ${ var . alarm_prefix } -ddb-${ var . table_name } -write-throttle"
263 alarm_description = " RELIABILITY: DynamoDB write throttling"
Original file line number Diff line number Diff line change 1+ resource "aws_cloudwatch_metric_alarm" "error_logs" {
2+ count = var. enable_error_log_metric ? 1 : 0
3+ alarm_name = " ${ var . alarm_prefix } -lambda-${ var . function_name } -error-logs"
4+ alarm_description = " ERROR: Lambda error logs detected"
5+
6+ namespace = var. error_log_metric_namespace
7+ metric_name = " ${ var . error_log_metric_name_prefix } ${ var . function_name } "
8+ statistic = " Sum"
9+ period = var. period_seconds
10+
11+ evaluation_periods = var. error_log_evaluation_periods
12+ threshold = var. error_log_threshold
13+ comparison_operator = " GreaterThanThreshold"
14+ treat_missing_data = " notBreaching"
15+
16+ actions_enabled = false
17+ alarm_actions = []
18+ ok_actions = []
19+ insufficient_data_actions = []
20+ tags = var. tags
21+ }
Original file line number Diff line number Diff line change 1+ resource "aws_cloudwatch_metric_alarm" "errors" {
2+ alarm_name = " ${ var . alarm_prefix } -lambda-${ var . function_name } -errors"
3+ alarm_description = " ERROR: Lambda errors"
4+
5+ namespace = " AWS/Lambda"
6+ metric_name = " Errors"
7+ statistic = " Sum"
8+ period = var. period_seconds
9+
10+ evaluation_periods = var. evaluation_periods
11+ threshold = var. errors_threshold
12+ comparison_operator = " GreaterThanThreshold"
13+ treat_missing_data = " notBreaching"
14+
15+ dimensions = { FunctionName = var.function_name }
16+
17+ actions_enabled = false
18+ alarm_actions = []
19+ ok_actions = []
20+ insufficient_data_actions = []
21+ tags = var. tags
22+ }
Original file line number Diff line number Diff line change 1+ resource "aws_cloudwatch_metric_alarm" "throttles" {
2+ alarm_name = " ${ var . alarm_prefix } -lambda-${ var . function_name } -throttles"
3+ alarm_description = " RELIABILITY: Lambda throttles"
4+
5+ namespace = " AWS/Lambda"
6+ metric_name = " Throttles"
7+ statistic = " Sum"
8+ period = var. period_seconds
9+
10+ evaluation_periods = var. evaluation_periods
11+ threshold = var. throttles_threshold
12+ comparison_operator = " GreaterThanThreshold"
13+ treat_missing_data = " notBreaching"
14+
15+ dimensions = { FunctionName = var.function_name }
16+
17+ actions_enabled = false
18+ alarm_actions = []
19+ ok_actions = []
20+ insufficient_data_actions = []
21+ tags = var. tags
22+ }
You can’t perform that action at this time.
0 commit comments