1

I have a dead-letter queue which receives messages as a result of a failed processing attempt from Lambda function. In this case, the NumberOfMessagesSent metric for the dead-letter queue is not available. Therefore I found a way to derive this Cloudwatch metric from ApproximateNumberOfMessagesVisible using a metric math like:

IF(DIFF(mDLQApproxNumberOfMessagesVisible) > 0, DIFF(mDLQApproxNumberOfMessagesVisible), 0)

This gave me the possibility to see how many messages were sent to the DLQ on a minutely basis:

enter image description here

What I want to do is to create a second metric eDLQNumberOfMessagesSentPerHour that will show me the total number of received messages within 1 hour.

Adding a second expression with SUM([eDLQNumberOfMessagesSent]) and period: 3600 does not work.

Full example:

{
    "metrics": [
        ["AWS/SQS", "ApproximateNumberOfMessagesVisible", "QueueName", "dlq.fifo", {
            "id": "mDLQApproxNumberOfMessagesVisible",
            "visible": false
        }],
        [{
            "expression": "IF(DIFF(mDLQApproxNumberOfMessagesVisible) > 0, DIFF(mDLQApproxNumberOfMessagesVisible), 0)",
            "label": "eDLQNumberOfMessagesSent",
            "id": "eDLQNumberOfMessagesSent",
            "period": 60,
            "stat": "Maximum"
        }],
        [{
            "expression": "SUM([eDLQNumberOfMessagesSent])",
            "label": "eDLQNumberOfMessagesSentPerHour",
            "id": "eDLQNumberOfMessagesSentPerHour",
            "period": 3600,
            "stat": "Sum"
        }]
    ],
    "view": "timeSeries",
    "stacked": false,
    "region": "eu-west-1",
    "stat": "Maximum",
    "period": 60
}
John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
user1718159
  • 561
  • 1
  • 6
  • 12

0 Answers0