Is it possible to calculate total time taken by each message group to process all messages in FIFO queue?

So I have created a FIFO queue where 10000 messages gets pushed which belong to 100 message groups and consumed by lambda.

So wanted to see the following questions metrics:

  1. What is the total time taken to process all messages in each message group in FIFO queue?
  2. What is the total time taken to process all messages in FIFO queue?

Lambda Invocations and Concurrent executions metrics are available.


Solution 1:

SQS is just a data store for messages. How much time it takes for the message to process or execute is not SQS concern. You can't get what you're looking for from SQS default metrics. You have to write custom logic in your message processor service (lambda here) to log the values into CloudWatch and create a metric from there.

Default AWS SQS available metrics can be found here https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-available-cloudwatch-metrics.html