diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bd4b10..95b5d94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Queue throughput columns — Done (24h) and Failed (24h) counts per queue on the Queues page; powered by two grouped COUNT queries; Done renders in green, Failed renders in red when non-zero - Auto-refresh on the Job History page — wraps the page in a turbo-frame polled every 10 seconds, matching the jobs and processes pages; pauses when the browser tab is hidden - Job History page (`/jobs/history`) — browsable list of all finished jobs (`finished_at IS NOT NULL`) ordered by most-recent-first; columns show class name (links to job detail), queue (clickable queue filter), duration (formatted as `Xs`, `Xm Xs`, or `Xh Xm`), and finished timestamp; filterable by time period (1h / 24h / 7d), queue name, and class name search; paginated; "Done (1h)" and "Done (24h)" dashboard stat cards now link to the history page pre-filtered by period; "History" nav link added between Jobs and Failed - Throughput section on the dashboard — "Done (1h)" and "Done (24h)" stat cards show completed-job counts; a full-width "Throughput — Last 12 Hours" card displays a pure-CSS bar chart (12 hourly buckets, oldest left → newest right, tick labels every 3 bars) with no JavaScript or charting library; powered by a single `pluck(:finished_at)` query with Ruby-side grouping for DB-agnostic compatibility; seed data updated with a realistic daily-pattern distribution so the chart shows meaningful data out of the box diff --git a/README.md b/README.md index 8c04f99..c41103a 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ SolidQueueWeb surfaces all of this in a browser UI available at any route you ch ## Features - **Dashboard** — stat cards showing counts for ready, scheduled, running, blocked, and failed jobs, plus queues, recurring tasks, and processes; "Done (1h)" and "Done (24h)" throughput cards; a "Throughput — Last 12 Hours" bar chart showing completed-job counts per hour (pure CSS, no charting library); auto-refreshes every 5 seconds -- **Queues** — all queues sorted by name with size, latency, and pause/resume controls +- **Queues** — all queues sorted by name with size, latency, Done (24h) and Failed (24h) throughput counts, and pause/resume controls - **Jobs** — filterable by status (ready, scheduled, claimed, blocked, failed) and by queue; search by job class name with dynamic auto-submit; time-based period filter (1 h / 24 h / 7 d); discard individual or all jobs; Turbo Frame navigation so only the table updates on filter or search; auto-refreshes every 10 seconds - **Failed jobs** — list of failed executions with error details; search by class name; filter by queue; time-based period filter; retry or discard individually or in bulk - **Job detail** — full arguments, timestamps, blocked-until date, and error backtrace; action buttons based on job status @@ -102,7 +102,6 @@ HTTP Basic authentication is used as a fallback when the block returns falsy. Planned features, roughly ordered by priority: **Near-term** -- Queue throughput columns on the Queues page — Completed (24h) and Failed (24h) per queue - Dark mode — CSS custom properties are already structured for it; toggle persists to `localStorage` **Medium-term** diff --git a/app/controllers/solid_queue_web/queues_controller.rb b/app/controllers/solid_queue_web/queues_controller.rb index 47393f8..012383d 100644 --- a/app/controllers/solid_queue_web/queues_controller.rb +++ b/app/controllers/solid_queue_web/queues_controller.rb @@ -2,6 +2,17 @@ module SolidQueueWeb class QueuesController < ApplicationController def index @queues = SolidQueue::Queue.all.sort_by(&:name) + + now = Time.current + @completed_24h = SolidQueue::Job + .where(finished_at: 24.hours.ago..now) + .group(:queue_name) + .count + @failed_24h = SolidQueue::FailedExecution + .joins(:job) + .where(created_at: 24.hours.ago..now) + .group("solid_queue_jobs.queue_name") + .count end def pause diff --git a/app/views/solid_queue_web/queues/index.html.erb b/app/views/solid_queue_web/queues/index.html.erb index b86670b..7b4ad83 100644 --- a/app/views/solid_queue_web/queues/index.html.erb +++ b/app/views/solid_queue_web/queues/index.html.erb @@ -10,6 +10,8 @@