Context
While working on setting up alarms for SQS in cloudwatch I came across this existing alarm ApproximateNumberOfMessagesVisible > 2000 for 5 datapoints within 5 minutes and I wanted to understand what it meant in some depth.
Here is a breakdown:
-
ApproximateNumberOfMessagesVisible: This is a metric that represents the number of messages available for retrieval from the queue. It doesn't include messages that are delayed or not visible because they've been retrieved by another process but not yet deleted (i.e., they are "in flight"). -
>2000: This indicates that the condition is met when there are more than 2000 messages available for retrieval. -
for 5 datapoints: A datapoint is an individual data record from a metric stream. In this context, it suggests that the metric must exceed the threshold of 2000 messages in 5 consecutive records. 5 datapoints means that there are five separate readings or measurements of theApproximateNumberOfMessagesVisiblemetric. -
within 5 minutes: Implies that these five readings are taken consecutively over 5 minutes, typically one reading per minute.
To summarise:
If your condition is ApproximateNumberOfMessagesVisible > 2000 for 5 datapoints within 5 minutes, it means that every minute, for five minutes, CloudWatch checks the number of visible messages. If each of those five readings shows more than 2000 messages waiting to be processed, then the condition is met.