Skip to content

feat: queue depth trend sparkline on dashboard#36

Merged
eclectic-coding merged 6 commits into
mainfrom
feat/queue-depth-trend
May 20, 2026
Merged

feat: queue depth trend sparkline on dashboard#36
eclectic-coding merged 6 commits into
mainfrom
feat/queue-depth-trend

Conversation

@eclectic-coding
Copy link
Copy Markdown
Owner

Summary

  • Adds a "Queue Depth — Last 12 Hours" card to the dashboard showing estimated queue depth at 12 hourly snapshots
  • Depth at time T is the count of jobs created before T that had not yet finished by T — DB-agnostic via a single pluck(:created_at, :finished_at) and Ruby-side grouping, matching the throughput chart pattern
  • Bars are purple to visually distinguish from the blue throughput chart and the red per-queue failure rate sparklines
  • Card header shows current total depth (ready + scheduled + claimed + blocked + failed); empty state shown when no active jobs in the window

Test plan

  • All 168 existing request specs pass, 100% line coverage maintained
  • RuboCop clean
  • Seed the dummy app (bundle exec rake dev:reset) and visit /jobs — the "Queue Depth — Last 12 Hours" card appears below the throughput chart with purple bars
  • Bars are sized proportionally and hover tooltips show the hour and job count
  • Card header shows "Now: X" matching the sum of the stat cards
  • Dark mode renders the purple bars correctly

🤖 Generated with Claude Code

eclectic-coding and others added 6 commits May 20, 2026 17:26
Add a "Queue Depth — Last 12 Hours" card to the dashboard showing
estimated queue depth at 12 hourly snapshots. Depth at time T is
computed as jobs created before T that have not yet finished by T —
DB-agnostic via a single pluck and Ruby-side grouping, mirroring the
throughput chart pattern. Bars are purple to distinguish from the blue
throughput and red failure rate charts. Empty state shown when no
active jobs exist in the window.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move all four index queries (stats, throughput, sparkline,
depth_sparkline) out of DashboardController into DashboardStats,
mirroring the QueueStats pattern. Controller index action is now
5 lines.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Controller index action is now one line. DashboardStats#stats
renamed to #counts to avoid @stats.stats in the view. View uses
dot notation: @stats.counts[:key], @stats.throughput, @stats.sparkline,
@stats.depth_sparkline.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
DashboardController#discard_all_blocked was a custom-named action;
extract it to BlockedJobsController#destroy following the 7-action
Rails convention. Dashboard "Retry All Failed" button now routes to
the existing RetryFailedJobsController#create (retry_all_failed_jobs_path)
eliminating DashboardController#retry_all_failed as well.

Routes: drop two custom POST routes; add singular resource :blocked_jobs.
Specs: move blocked-jobs coverage to blocked_jobs_spec.rb; retry_all
coverage already exists in failed_jobs_spec.rb.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Track remaining non-standard actions: QueuesController pause/resume
and Queues::JobsController discard_all.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@eclectic-coding eclectic-coding merged commit 3ccebb8 into main May 20, 2026
7 checks passed
@eclectic-coding eclectic-coding deleted the feat/queue-depth-trend branch May 20, 2026 21:54
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