Skip to content

Fix/job queue metrics dashboard reports progress - #906

Merged
Jayy4rl merged 4 commits into
StellarYield:mainfrom
DevNetlife:fix/job-queue-metrics-dashboard-reports-progress
Jul 29, 2026
Merged

Fix/job queue metrics dashboard reports progress#906
Jayy4rl merged 4 commits into
StellarYield:mainfrom
DevNetlife:fix/job-queue-metrics-dashboard-reports-progress

Conversation

@DevNetlife

@DevNetlife DevNetlife commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

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.

@DevNetlife
DevNetlife force-pushed the fix/job-queue-metrics-dashboard-reports-progress branch from daab701 to 907e744 Compare July 28, 2026 21:11
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@Jayy4rl
Jayy4rl merged commit df991b3 into StellarYield:main Jul 29, 2026
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants