mirror of
https://github.com/Sea-Haven-Industries/procurement-ingest.git
synced 2026-09-30 07:13:13 +00:00
73 lines
2.5 KiB
HCL
73 lines
2.5 KiB
HCL
resource "aws_cloudwatch_metric_alarm" "procurement_api_errors" {
|
|
alarm_name = "procurement-api-errors"
|
|
alarm_description = "procurement-api Lambda raised (bundle/init failures; the handler catches request errors, so any signal here is structural)"
|
|
comparison_operator = "GreaterThanThreshold"
|
|
evaluation_periods = 1
|
|
metric_name = "Errors"
|
|
namespace = "AWS/Lambda"
|
|
period = 300
|
|
statistic = "Sum"
|
|
threshold = 0
|
|
treat_missing_data = "notBreaching"
|
|
alarm_actions = [data.aws_sns_topic.site_alerts.arn]
|
|
|
|
dimensions = {
|
|
FunctionName = aws_lambda_function.procurement_api.function_name
|
|
}
|
|
}
|
|
|
|
resource "aws_cloudwatch_metric_alarm" "procurement_api_throttles" {
|
|
alarm_name = "procurement-api-throttles"
|
|
alarm_description = "procurement-api Lambda throttled"
|
|
comparison_operator = "GreaterThanThreshold"
|
|
evaluation_periods = 1
|
|
metric_name = "Throttles"
|
|
namespace = "AWS/Lambda"
|
|
period = 300
|
|
statistic = "Sum"
|
|
threshold = 0
|
|
treat_missing_data = "notBreaching"
|
|
alarm_actions = [data.aws_sns_topic.site_alerts.arn]
|
|
|
|
dimensions = {
|
|
FunctionName = aws_lambda_function.procurement_api.function_name
|
|
}
|
|
}
|
|
|
|
resource "aws_cloudwatch_metric_alarm" "procurement_api_duration" {
|
|
alarm_name = "procurement-api-duration"
|
|
alarm_description = "procurement-api p99 duration >= 22.5s (75% of the 30s timeout; scans degrading toward timeout)"
|
|
comparison_operator = "GreaterThanOrEqualToThreshold"
|
|
evaluation_periods = 3
|
|
datapoints_to_alarm = 2
|
|
metric_name = "Duration"
|
|
namespace = "AWS/Lambda"
|
|
period = 300
|
|
extended_statistic = "p99"
|
|
threshold = 22500
|
|
treat_missing_data = "notBreaching"
|
|
alarm_actions = [data.aws_sns_topic.site_alerts.arn]
|
|
|
|
dimensions = {
|
|
FunctionName = aws_lambda_function.procurement_api.function_name
|
|
}
|
|
}
|
|
|
|
resource "aws_cloudwatch_metric_alarm" "procurement_api_5xx" {
|
|
alarm_name = "procurement-api-5xx"
|
|
alarm_description = "procurement-api gateway 5XX responses"
|
|
comparison_operator = "GreaterThanThreshold"
|
|
evaluation_periods = 1
|
|
metric_name = "5XXError"
|
|
namespace = "AWS/ApiGateway"
|
|
period = 300
|
|
statistic = "Sum"
|
|
threshold = 0
|
|
treat_missing_data = "notBreaching"
|
|
alarm_actions = [data.aws_sns_topic.site_alerts.arn]
|
|
|
|
dimensions = {
|
|
ApiName = "procurement-api"
|
|
Stage = local.api_stage_name
|
|
}
|
|
}
|