danihodovic / celery-exporter

A Prometheus exporter for Celery metrics
MIT License
409 stars 90 forks source link

Add Sentinel support for the celery_queue_size metric #220

Closed roganartu closed 1 year ago

roganartu commented 1 year ago

This metric is currently gated behind a small list of supported transports that doesn't include Sentinel: https://github.com/danihodovic/celery-exporter/blob/5775bd5cbd00747ab3fc5be3213ac267ec549d30/src/exporter.py#L106-L138

From what I can tell, it's because the redis implementation doesn't have Sentinel support (and that this exporter leans on Celery itself for all other metrics). See: https://github.com/danihodovic/celery-exporter/blob/5775bd5cbd00747ab3fc5be3213ac267ec549d30/src/exporter.py#L321-L322

I think this should be fairly easy to add, by just looking up the master every time we need the queue size, per https://stackoverflow.com/a/45886136.

I'm happy to take a crack at a diff. We started using this exporter to get queue sizes, but obviously want to stick with sentinel support if we can.