Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ immunisation_account_id = "084828561157"
dspp_core_account_id = "603871901111"
pds_environment = "int"
error_alarm_notifications_enabled = true

# mesh no invocation period metric set to 3 days (in seconds) for preprod environment i.e 3 * 24 * 60 * 60
mesh_no_invocation_period_seconds = 259200
create_mesh_processor = true
has_sub_environment_scope = false
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ immunisation_account_id = "084828561157"
dspp_core_account_id = "603871901111"
pds_environment = "int"
error_alarm_notifications_enabled = true

# mesh no invocation period metric set to 3 days (in seconds) for preprod environment i.e 3 * 24 * 60 * 60
mesh_no_invocation_period_seconds = 259200
create_mesh_processor = true
has_sub_environment_scope = false
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ immunisation_account_id = "664418956997"
dspp_core_account_id = "232116723729"
pds_environment = "prod"
error_alarm_notifications_enabled = true

# mesh no invocation period metric set to 1 day (in seconds) for prod environment i.e 1 * 24 * 60 * 60
mesh_no_invocation_period_seconds = 86400
create_mesh_processor = true
has_sub_environment_scope = false
dspp_kms_key_alias = "nhsd-dspp-core-prod-extended-attributes-gdp-key"
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ immunisation_account_id = "664418956997"
dspp_core_account_id = "232116723729"
pds_environment = "prod"
error_alarm_notifications_enabled = true

# mesh no invocation period metric set to 1 day (in seconds) for prod environment i.e 1 * 24 * 60 * 60
mesh_no_invocation_period_seconds = 86400
create_mesh_processor = true
has_sub_environment_scope = false
dspp_kms_key_alias = "nhsd-dspp-core-prod-extended-attributes-gdp-key"
22 changes: 22 additions & 0 deletions infrastructure/instance/mesh_processor.tf
Original file line number Diff line number Diff line change
Expand Up @@ -288,3 +288,25 @@ resource "aws_cloudwatch_metric_alarm" "mesh_processor_error_alarm" {
alarm_actions = [data.aws_sns_topic.imms_system_alert_errors.arn]
treat_missing_data = "notBreaching"
}

resource "aws_cloudwatch_metric_alarm" "mesh_processor_no_lambda_invocation_alarm" {
count = var.create_mesh_processor && var.error_alarm_notifications_enabled ? 1 : 0

alarm_name = "imms-${local.resource_scope}-mesh-processor-no-lambda-invocation"
alarm_description = "Triggers when the MESH Processor Lambda has no invocations for the configured time window."

metric_name = "Invocations"
namespace = "AWS/Lambda"
statistic = "Sum"
period = var.mesh_no_invocation_period_seconds

evaluation_periods = 1
comparison_operator = "LessThanThreshold"
threshold = 1
treat_missing_data = "breaching"
dimensions = {
FunctionName = aws_lambda_function.mesh_file_converter_lambda[0].function_name
}

alarm_actions = [data.aws_sns_topic.imms_system_alert_errors.arn]
}
6 changes: 6 additions & 0 deletions infrastructure/instance/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ variable "pds_environment" {
default = "int"
}

variable "mesh_no_invocation_period_seconds" {
description = "The maximum duration the MESH Processor Lambda can go without being invoked before the no-invocation alarm is triggered."
type = number
default = 300
}

# Remember to switch off in PR envs after testing
variable "error_alarm_notifications_enabled" {
default = true
Expand Down