Skip to content

feat: add queue depth metrics for indexer workers#169

Closed
Uchechukwu-Ekezie wants to merge 1 commit into
accesslayerorg:mainfrom
OpenSourceCOntr:feat/queue-depth-metrics-161
Closed

feat: add queue depth metrics for indexer workers#169
Uchechukwu-Ekezie wants to merge 1 commit into
accesslayerorg:mainfrom
OpenSourceCOntr:feat/queue-depth-metrics-161

Conversation

@Uchechukwu-Ekezie
Copy link
Copy Markdown
Contributor

Fixes #161

What changed

  • Added src/utils/queue-metrics.utils.ts — in-process registry with setQueueDepth(queue, state, depth) and getQueueDepths()
  • Added GET /api/v1/metrics/queues endpoint returning per-queue, per-state depth with timestamp
  • Documented alerting thresholds in the utility file:
    • pending > 500 → warning; > 2000 → critical
    • failed > 50 → warning; > 200 → critical
    • dlq > 0 → warning

Why

Operators need visibility into indexer worker backlog without polling the DB. Workers call setQueueDepth() after each cycle; the metrics endpoint reflects the latest observed depth instantly.

How to test

  1. Call setQueueDepth('creator-events', 'pending', 42) in a test or seed script
  2. GET /api/v1/metrics/queues should return the entry with queue, state, depth, and updatedAt
  3. Calling setQueueDepth again with a new depth should update the entry

- Add in-process queue depth registry (setQueueDepth/getQueueDepths) in queue-metrics.utils.ts
- Workers call setQueueDepth(queue, state, depth) after each poll cycle
- Expose GET /api/v1/metrics/queues — returns per-queue, per-state depth with timestamp
- Document alerting thresholds: pending>500 warning, >2000 critical; failed>50 warning, >200 critical; dlq>0 warning

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 25, 2026

@Uchechukwu-Ekezie 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

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.

Add queue depth metrics for indexer workers

1 participant