Skip to content

feat: add queue depth alert webhook#51

Merged
eclectic-coding merged 2 commits into
mainfrom
feat/queue-depth-alert
May 21, 2026
Merged

feat: add queue depth alert webhook#51
eclectic-coding merged 2 commits into
mainfrom
feat/queue-depth-alert

Conversation

@eclectic-coding
Copy link
Copy Markdown
Owner

Summary

  • New alert_queue_thresholds config — a hash of queue_name => ready_job_count limits
  • Fires a webhook when any configured queue's ready count meets or exceeds its threshold
  • Uses the same alert_webhook_url endpoint(s) as the failure alert, with event: "queue_depth_threshold_exceeded" plus queue_name, depth, and threshold fields
  • Cooldown tracked independently per queue — a persistently deep "critical" queue does not suppress alerts for "default"
  • Triggered from DashboardController#index alongside the existing AlertWebhook

Implementation

  • QueueDepthAlert service — self-contained, mirrors the structure of AlertWebhook; queries per-queue ready counts via a single grouped COUNT; per-queue @last_fired_at hash behind the same MUTEX pattern
  • alert_queue_thresholds reader defaults to {} so unconfigured apps are unaffected
  • 12 specs covering threshold boundary, per-queue independence, cooldown isolation, payload shape, and error handling

Test plan

  • Set alert_queue_thresholds: { "critical" => 5 } — enqueue 5+ ready jobs to "critical" → webhook fires on next dashboard load
  • Enqueue fewer than 5 → no webhook
  • Enqueue to "default" (no threshold configured) → no webhook
  • Two queues both over threshold → two webhooks fire
  • Fire once, reload dashboard within cooldown → only one webhook total
  • Cooldown expires for "critical" but not "default" → only "critical" fires again

🤖 Generated with Claude Code

eclectic-coding and others added 2 commits May 21, 2026 16:39
New alert_queue_thresholds config accepts a hash of queue_name =>
ready-job-count limits. A webhook fires when any queue's ready count
meets or exceeds its threshold, using the same alert_webhook_url
endpoint(s) with event "queue_depth_threshold_exceeded". Cooldown is
tracked independently per queue so a busy queue does not suppress
alerts for others.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@eclectic-coding eclectic-coding merged commit 742f6ee into main May 21, 2026
5 checks passed
@eclectic-coding eclectic-coding deleted the feat/queue-depth-alert branch May 21, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant