Fix/job queue metrics dashboard reports progress - #906
Merged
Jayy4rl merged 4 commits intoJul 29, 2026
Merged
Conversation
DevNetlife
force-pushed
the
fix/job-queue-metrics-dashboard-reports-progress
branch
from
July 28, 2026 21:11
daab701 to
907e744
Compare
|
@DevNetlife Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
Prometheus Job Queue Metrics (Closes #854)
Added job_queue_pending_total gauge with label { job_name }.
Added job_queue_failed_total counter with label { job_name }.
Added job_duration_seconds histogram with label { job_name }.
Updated GET /metrics exporter to fetch current pending job counts from pgboss.job alongside existing HTTP metrics.
Admin Job Queue Dashboard (Closes #853)
Added GET /api/v1/admin/jobs/dashboard endpoint returning { queues: [{ name, pending, active, failed, completed24h }] }.
Queries pg-boss's internal pgboss.job table and aggregates per job type.
Protected by requireApiKey.
Scheduled Report Pre-Generation via pg-boss Cron (Closes #852)
Created database migration 030_cached_reports.sql for storing cached annual vault reports.
Registered pg-boss cron schedule "5 0 1 * *" (1st of each month at 00:05 UTC) for the "report-generate" job.
Updated GET /api/v1/vaults/:contractId/report?year=YYYY to serve cached report data when available and refresh cache on scheduled runs.
Backfill Job Progress Reporting (Closes #851)
Added progress reporting to backfill workers (job.send({ progress: N })), reporting progress every 10 batches processed.
Updated GET /api/v1/admin/jobs/:jobId to include progress: number | null (0–100).
Ensured completed jobs report progress: 100.
Verification & Testing
TypeScript: Ran npx tsc --noEmit cleanly with zero type errors.
Unit Tests:
src/services/jobQueueMetrics.test.ts: Verified Prometheus metrics collection and report worker pre-generation.
src/api/controllers/admin.test.ts: Verified dashboard aggregation output and progress field in job status response.
src/services/indexerBackfillWorker.test.ts: Verified progress callback parameter passing.