$ show UpHabit/bull_exporter
Bull Exporter is a Prometheus metrics exporter for Bull queues running on Redis. It provides an HTTP server (default port 9538) that exposes queue state metrics (waiting, active, delayed, failed, completed counts) and job duration summaries. It supports automatic queue discovery by scanning Redis keys, and can also be run in one-shot mode to print metrics to stdout. The application is built with Express, Bull, ioredis, and prom-client, and is packaged as a Docker image. The codebase is well-structured with TypeScript, strict compiler options, comprehensive unit tests using Jest and real Redis, and CI/CD pipelines (Travis CI and CircleCI). However, the project has been stale since October 2020, uses very outdated dependencies (Node.js 10, TypeScript 3.9, old prom-client), and has no recent maintenance activity. The code quality is solid for its time but suffers from technical drift.
The LLM identified 2 files worth highlighting for reuse:
A self-contained Python script that uses the grafanalib library to generate a Grafana dashboard JSON for visualizing Bull queue metrics exposed by the exporter. It demonstrates a clean, parameterized approach to dashboard-as-code and can be reused with minimal adaptation for any Prometheus exporter that exposes Bull metrics with the default metric prefix.
The core class managing Bull queues, metric registration, and auto-discovery. It reuses a single Redis client for Bull's 'client' connection while creating separate connections for subscribers/bclient, which reduces resource usage. The `discoverAll` method uses async iteration over ioredis's scanStream to incrementally discover queues by matching Redis key patterns, a modern, memory-efficient pattern. The class is well-organized with clear separation of concerns (discovery, update, completion event listening) and handles cleanup gracefully. Although tied to Bull's API, the design patterns (shared client, event-based metrics, async iteration) are transferable to other queue-based metric collectors.