Skip to content

Commit 9168819

Browse files
committed
format
1 parent 0f63265 commit 9168819

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

django_prometheus/db/common.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,18 @@ class CursorWrapper(cursor_class):
6363

6464
def execute(self, *args, **kwargs):
6565
execute_total.labels(alias, vendor).inc()
66-
with query_duration_seconds.labels(**labels).time(), ExceptionCounterByType(
67-
errors_total, extra_labels=labels
66+
with (
67+
query_duration_seconds.labels(**labels).time(),
68+
ExceptionCounterByType(errors_total, extra_labels=labels),
6869
):
6970
return super().execute(*args, **kwargs)
7071

7172
def executemany(self, query, param_list, *args, **kwargs):
7273
execute_total.labels(alias, vendor).inc(len(param_list))
7374
execute_many_total.labels(alias, vendor).inc(len(param_list))
74-
with query_duration_seconds.labels(**labels).time(), ExceptionCounterByType(
75-
errors_total, extra_labels=labels
75+
with (
76+
query_duration_seconds.labels(**labels).time(),
77+
ExceptionCounterByType(errors_total, extra_labels=labels),
7678
):
7779
return super().executemany(query, param_list, *args, **kwargs)
7880

django_prometheus/tests/end2end/testapp/test_caches.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
_SUPPORTED_CACHES = ["memcached.PyLibMCCache", "memcached.PyMemcacheCache", "filebased", "locmem", "native_redis"]
88

9+
910
class TestCachesMetrics:
1011
"""Test django_prometheus.caches metrics."""
1112

@@ -33,7 +34,7 @@ def test_counters(self, supported_cache):
3334

3435
def test_redis_cache_fail(self):
3536
# Note: test use fake service config (like if server was stopped)
36-
supported_cache = "native_redis"
37+
supported_cache = "redis"
3738
total_before = get_metric("django_cache_get_total", backend=supported_cache) or 0
3839
fail_before = get_metric("django_cache_get_fail_total", backend=supported_cache) or 0
3940
hit_before = get_metric("django_cache_get_hits_total", backend=supported_cache) or 0

0 commit comments

Comments
 (0)