-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add form submission health check metrics (#681)
Add a CloudWatch metric filter for successful and failed form submissions through the client app.
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# | ||
# Metrics that will be used to monitor the behaviour and health of the app | ||
# | ||
locals { | ||
healthcheck_metrics = [{ | ||
name = "FormsClientSubmitSuccess" | ||
pattern = "Response submitted for Form ID" | ||
log_group_name = var.ecs_cloudwatch_log_group_name | ||
}, { | ||
name = "FormsClientSubmitFailed" | ||
pattern = "Attempted response submission for Form ID" | ||
log_group_name = var.ecs_cloudwatch_log_group_name | ||
}] | ||
} | ||
|
||
resource "aws_cloudwatch_log_metric_filter" "healthcheck" { | ||
for_each = { for metric in local.healthcheck_metrics : metric.name => metric } | ||
|
||
name = each.value.name | ||
pattern = each.value.pattern | ||
log_group_name = each.value.log_group_name | ||
|
||
metric_transformation { | ||
name = each.value.name | ||
namespace = "forms" | ||
value = "1" | ||
default_value = "0" | ||
unit = "Count" | ||
} | ||
} |