正确计算发送到死信 SQS 队列的消息数
Correctly calculate number of sent messages to Dead Letter SQS queue
我希望 grafana 报告在任何给定时间死信队列中有多少消息。最终出现在该队列中的消息将根据最终出现在该队列中的性质进行评估和解析。
我已将 grafana 配置为从 dead-letter
队列读取 NumberOfMessagesSent
,但是,该值始终为 0
,因为;我认为最终到达此处的消息是从另一个队列(通过 SQS)发送的。
尽管我可以看到消息已发送到 dead-letter
队列(不是以编程方式),但是由另一个在 X 次接收后配置的队列发送的。
有解决办法吗?
快速回答:
唯一可以在 SQS DLQ 上真正监控的指标是 ApproximateNumberOfMessagesVisible
.
TLDR:
当新消息到达 SQS DLQ 时,NumberOfMessagesSent
或 NumberOfMessagesReceived
都不会增加。
来自 AWS Documentation 的引用:
If you send a message to a dead-letter queue manually, it is captured
by the NumberOfMessagesSent metric. However, if a message is sent to a
dead-letter queue as a result of a failed processing attempt, it isn't
captured by this metric. Thus, it is possible for the values of
NumberOfMessagesSent and NumberOfMessagesReceived to be different.
NumberOfMessagesSent
表示:
How many of messages you have sent to the queue (except messages which arrived to DLQ as result of failure)
NumberOfMessagesReceived
表示:
How many of messages you have received from the queue
ApproximateNumberOfMessagesVisible
表示:
Total number or messages, which are visible in the queue. (Remember when you receive message from the queue you have to set visibility timeout == how long message you have received is not visible for others. Also remember you should delete message after successful processing, otherwise it will be after visibility timeout available to others.)
因为 NumberOfMessagesReceived 和 NumberOfMessagesSent 的指标取决于消息的排队方式,正如 David Navrkal 提到的那样,我使用指标 ApproximateNumberOfMessagesDelayed 设计了一个新的解决方案来满足我们的需求。在 dlq 设置上,我添加了延迟以使用此指标。
ie: DelaySeconds: 60 #for alarms
有关 yaml,请参阅 Configure SQS Dead letter Queue to raise a cloud watch alarm on receiving a message。
我希望 grafana 报告在任何给定时间死信队列中有多少消息。最终出现在该队列中的消息将根据最终出现在该队列中的性质进行评估和解析。
我已将 grafana 配置为从 dead-letter
队列读取 NumberOfMessagesSent
,但是,该值始终为 0
,因为;我认为最终到达此处的消息是从另一个队列(通过 SQS)发送的。
尽管我可以看到消息已发送到 dead-letter
队列(不是以编程方式),但是由另一个在 X 次接收后配置的队列发送的。
有解决办法吗?
快速回答:
唯一可以在 SQS DLQ 上真正监控的指标是 ApproximateNumberOfMessagesVisible
.
TLDR:
当新消息到达 SQS DLQ 时,NumberOfMessagesSent
或 NumberOfMessagesReceived
都不会增加。
来自 AWS Documentation 的引用:
If you send a message to a dead-letter queue manually, it is captured by the NumberOfMessagesSent metric. However, if a message is sent to a dead-letter queue as a result of a failed processing attempt, it isn't captured by this metric. Thus, it is possible for the values of NumberOfMessagesSent and NumberOfMessagesReceived to be different.
NumberOfMessagesSent
表示:
How many of messages you have sent to the queue (except messages which arrived to DLQ as result of failure)
NumberOfMessagesReceived
表示:
How many of messages you have received from the queue
ApproximateNumberOfMessagesVisible
表示:
Total number or messages, which are visible in the queue. (Remember when you receive message from the queue you have to set visibility timeout == how long message you have received is not visible for others. Also remember you should delete message after successful processing, otherwise it will be after visibility timeout available to others.)
因为 NumberOfMessagesReceived 和 NumberOfMessagesSent 的指标取决于消息的排队方式,正如 David Navrkal 提到的那样,我使用指标 ApproximateNumberOfMessagesDelayed 设计了一个新的解决方案来满足我们的需求。在 dlq 设置上,我添加了延迟以使用此指标。
ie: DelaySeconds: 60 #for alarms
有关 yaml,请参阅 Configure SQS Dead letter Queue to raise a cloud watch alarm on receiving a message。