From f16dd4dd803f64c68e5103d75b5989124292bf1d Mon Sep 17 00:00:00 2001 From: rzelazo Date: Tue, 5 Sep 2023 22:51:29 +0200 Subject: [PATCH] Fixed incompatibility with django_redis >= 4.12.0 Fixed bug caused by trying to use global level logger variable from django_redis.cache that has been moved to django_redis.cache.RedisCache instance attribute since django_redis 4.12.0 release. --- django_prometheus/cache/backends/redis.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/django_prometheus/cache/backends/redis.py b/django_prometheus/cache/backends/redis.py index f8af1a7a..d39a7a18 100644 --- a/django_prometheus/cache/backends/redis.py +++ b/django_prometheus/cache/backends/redis.py @@ -1,5 +1,6 @@ from django_redis import cache, exceptions + from django_prometheus.cache.metrics import ( django_cache_get_fail_total, django_cache_get_total, @@ -20,7 +21,7 @@ def get(self, key, default=None, version=None, client=None): django_cache_get_fail_total.labels(backend="redis").inc() if self._ignore_exceptions: if self._log_ignored_exceptions: - cache.logger.error(str(e)) + self.logger.error(str(e)) return default raise else: