Skip to content

Commit

Permalink
feat: add form submission health check metrics (#681)
Browse files Browse the repository at this point in the history
Add a CloudWatch metric filter for successful and failed form submissions
through the client app.
  • Loading branch information
patheard authored Jun 12, 2024
1 parent 140a250 commit 182e920
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions aws/alarms/metrics.tf
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"
}
}

0 comments on commit 182e920

Please sign in to comment.