Provides Prometheus metrics for Bull
Metrics:
- waiting jobs (gauge)
- active jobs (gauge)
- completed jobs (gauge)
- failed jobs (gauge)
- delayed jobs (gauge)
import Queue from 'bull';
import promClient from 'prom-client';
import * as bullProm from 'bull-prom';
const queue = new Queue('myQueue'...);
const bullMetric = bullProm.init({
queue,
promClient, // optional, it will use internal prom client if it is not given
interval: 1000, // optional, in ms, default to 60000
});
bullMetric.run();
// Metrics result in Promotheus
// jobs_waiting_total{queue_name="myQueue"} 0
// jobs_active_total{queue_name="myQueue"} 0
// jobs_complete_total{queue_name="myQueue"} 0
// jobs_failed_total{queue_name="myQueue"} 0
// jobs_delayed_total{queue_name="myQueue"} 0
Initialize
options:
- queue (required): bull queue
- promClient (optional): prom client instance
- interval (optional, default 60000): interval in ms to fetch the Bull statistic
Start running and fetching the data from Bull based on interval
Stop running
MIT © Pawel Badenski
This library is largely derived from kue-prom (MIT © Budi Irawan)