Hourly Amazon SQS queue metrics logged to Google Sheets

By General Input

Every hour, log queue backlog and dead-letter growth from Amazon SQS into a Google Sheet so your team can chart trends and spot regressions.

Integrations

  • Amazon SQS
  • Google Sheets

Type

Deterministic Code

Categories

  • Operations
  • Engineering

Every hour, pull queue depth metrics from Amazon SQS and append one row per queue to a Google Sheet so the team can chart backlog and dead-letter growth over time without setting up CloudWatch alarms.

Trigger: cron on an hourly schedule. Make the cron expression a workflow input so anyone can dial it up or down (every 15 minutes, every 6 hours) without editing code.

Inputs (all configurable): a Google Sheets spreadsheet ID, a sheet/tab name (default "sqs-metrics"), and how to select queues — either an explicit list of queue URLs, or a name prefix used to discover queues. Support both modes: if the queue-URL list is non-empty use it verbatim; otherwise call Amazon SQS ListQueues with the configured QueueNamePrefix to discover queues in the connected region. When neither is set, fall back to ListQueues with no prefix so every queue in the region is logged.

For each queue URL, call Amazon SQS GetQueueAttributes and request these four attribute names: ApproximateNumberOfMessages, ApproximateNumberOfMessagesNotVisible, ApproximateNumberOfMessagesDelayed, and ApproximateAgeOfOldestMessage. Derive the queue name as the last path segment of the QueueUrl so the sheet stays human-readable.

Once all queues are collected, append rows to the Google Sheet in a single Google Sheets Append Values call (one row per queue, batched into the same request). Use valueInputOption USER_ENTERED and target the range <sheetName>!A:F. Columns, in order: timestamp (ISO 8601 UTC of when the run started, same value for every row in this run), queue name, visible (ApproximateNumberOfMessages as an integer), in flight (ApproximateNumberOfMessagesNotVisible as an integer), delayed (ApproximateNumberOfMessagesDelayed as an integer), oldest age seconds (ApproximateAgeOfOldestMessage as an integer).

Header row: on the first run against an empty sheet, prepend a header row with the six column names above so the resulting sheet is chart-ready. On subsequent runs, do not touch existing rows — Append Values naturally lands after the last populated row of the detected table.

Error handling: if GetQueueAttributes fails for a single queue (for example the queue was deleted between ListQueues and the read), log a warning and skip that queue rather than aborting the run; still append rows for the queues that succeeded. If Amazon SQS returns RequestThrottled, retry that single queue with exponential backoff (start around 1s, cap around 30s). If the Google Sheets append returns 429, retry the append with exponential backoff. Any other failure should end the run so it surfaces in the workflow history.

Output: a rolling time series in Google Sheets that the team can chart directly (line chart of visible vs in flight per queue, or a filter view for a single queue name) to spot backlog regressions and dead-letter growth by eye. No alerting is in scope — the goal is trend visibility.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentLocal listing health board for every location you manageLet support send one-off Loops emails without an engineerStop cold emails to anyone with a live deal in PipedriveiMessage campaign console with pre-flight checks and delivery boardLinkedIn Ads budget pacing dashboard for every client accountFront desk appointment confirmation board for the next 3 daysGive your team Looker numbers without buying more seatsBuild audience segments from product usage and push to LoopsTurn the people who engage with your posts into Pipedrive leads