django-redis-metrics icon indicating copy to clipboard operation
django-redis-metrics copied to clipboard

Non-fatal error if Redis is unavailable

Open djjudas21 opened this issue 4 years ago • 0 comments

Hi there,

I'm investigating using this for some simple metrics about a new project I'm building. For me, it's no problem to run with Redis in production but in development, I don't want to have to run a local Redis server (and expect any contributors to my project to have to do the same).

I wonder if there is scope for an option that can be set for redis-metrics which if it can't connect to Redis on startup, emits a warning but does not terminate, and all future calls to metrics() etc appear to work fine, but the data gets blackholed and a warning is printed in the log.

This would allow people to run manage.py runserver for local development without having to set up Redis. It would also be an opt-in feature so the current behaviour is retained by default.

Something like:

REDIS_METRICS = {
   'DIE_IF_REDIS_UNAVAILABLE': False,
}

Thanks, Jonathan

djjudas21 avatar Mar 30 '20 15:03 djjudas21