Skip to content
Open
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
37 changes: 37 additions & 0 deletions prod-eu-west/services/client-api/queue-worker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -329,5 +329,42 @@ resource "aws_cloudwatch_metric_alarm" "queue_worker_scale_down_alarm" {
}
}
}
}

resource "aws_cloudwatch_metric_alarm" "events_other_doi_job_scale_up_alarm" {
alarm_name = "events_other_doi_job_worker_scale_up_alarm"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "1"
alarm_description = "Scale up when the new queue gets large"
alarm_actions = [aws_appautoscaling_policy.queue-worker_scale_up.arn]

threshold = "3000000"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're expecting 3 million messages as a baseline? that's a lot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 4 million messages in the queue at the moment. I've set the message lifetime to ten days since these operations are not time sensitive.


metric_name = "ApproximateNumberOfMessagesVisible"
namespace = "AWS/SQS"
period = "600"
statistic = "Maximum"

dimensions = {
QueueName = "production_events_other_doi_job"
}
}

resource "aws_cloudwatch_metric_alarm" "events_other_doi_job_worker_scale_down_alarm" {
alarm_name = "events_other_doi_job_worker_scale_down_alarm"
comparison_operator = "LessThanOrEqualToThreshold"
evaluation_periods = "2"
alarm_description = "Scale down when the new queue shrinks"
alarm_actions = [aws_appautoscaling_policy.queue-worker_scale_down.arn]

threshold = "1000000"

metric_name = "ApproximateNumberOfMessagesVisible"
namespace = "AWS/SQS"
period = "600"
statistic = "Maximum"

dimensions = {
QueueName = "production_events_other_doi_job"
}
}