django-prometheus 2.4.0.dev15__tar.gz → 2.4.0.dev17__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. {django_prometheus-2.4.0.dev15/django_prometheus.egg-info → django_prometheus-2.4.0.dev17}/PKG-INFO +2 -1
  2. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/__init__.py +1 -1
  3. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/cache/backends/redis.py +15 -18
  4. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/db/backends/postgis/base.py +5 -2
  5. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/db/backends/postgresql/base.py +5 -2
  6. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/middleware.py +2 -2
  7. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17/django_prometheus.egg-info}/PKG-INFO +2 -1
  8. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus.egg-info/SOURCES.txt +0 -1
  9. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/setup.py +1 -0
  10. django_prometheus-2.4.0.dev15/django_prometheus/db/backends/common.py +0 -9
  11. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/LICENSE +0 -0
  12. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/MANIFEST.in +0 -0
  13. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/README.md +0 -0
  14. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/apps.py +0 -0
  15. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/cache/__init__.py +0 -0
  16. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/cache/backends/__init__.py +0 -0
  17. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/cache/backends/django_memcached_consul.py +0 -0
  18. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/cache/backends/filebased.py +0 -0
  19. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/cache/backends/locmem.py +0 -0
  20. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/cache/backends/memcached.py +0 -0
  21. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/cache/metrics.py +0 -0
  22. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/conf/__init__.py +0 -0
  23. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/db/__init__.py +0 -0
  24. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/db/backends/__init__.py +0 -0
  25. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/db/backends/mysql/__init__.py +0 -0
  26. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/db/backends/mysql/base.py +0 -0
  27. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/db/backends/postgis/__init__.py +0 -0
  28. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/db/backends/postgresql/__init__.py +0 -0
  29. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/db/backends/spatialite/__init__.py +0 -0
  30. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/db/backends/spatialite/base.py +0 -0
  31. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/db/backends/sqlite3/__init__.py +0 -0
  32. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/db/backends/sqlite3/base.py +0 -0
  33. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/db/common.py +0 -0
  34. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/db/metrics.py +0 -0
  35. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/exports.py +0 -0
  36. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/migrations.py +0 -0
  37. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/models.py +0 -0
  38. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/tests/__init__.py +0 -0
  39. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/tests/test_django_prometheus.py +0 -0
  40. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/tests/test_exports.py +0 -0
  41. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/tests/test_testutils.py +0 -0
  42. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/testutils.py +0 -0
  43. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/urls.py +0 -0
  44. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus/utils.py +0 -0
  45. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus.egg-info/dependency_links.txt +0 -0
  46. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus.egg-info/requires.txt +0 -0
  47. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/django_prometheus.egg-info/top_level.txt +0 -0
  48. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/pyproject.toml +0 -0
  49. {django_prometheus-2.4.0.dev15 → django_prometheus-2.4.0.dev17}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-prometheus
3
- Version: 2.4.0.dev15
3
+ Version: 2.4.0.dev17
4
4
  Summary: Django middlewares to monitor your application with Prometheus.io.
5
5
  Home-page: http://github.com/korfuri/django-prometheus
6
6
  Author: Uriel Corfa
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.9
20
20
  Classifier: Programming Language :: Python :: 3.10
21
21
  Classifier: Programming Language :: Python :: 3.11
22
22
  Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
23
24
  Classifier: Framework :: Django :: 4.2
24
25
  Classifier: Framework :: Django :: 5.0
25
26
  Classifier: Framework :: Django :: 5.1
@@ -10,7 +10,7 @@ from django_prometheus import middleware, models
10
10
 
11
11
  __all__ = ["middleware", "models", "pip_prometheus"]
12
12
 
13
- __version__ = "2.4.0.dev15"
13
+ __version__ = "2.4.0.dev17"
14
14
 
15
15
 
16
16
  # Import pip_prometheus to export the pip metrics automatically.
@@ -1,4 +1,4 @@
1
- from django import VERSION as DJANGO_VERSION
1
+ from django.core.cache.backends.redis import RedisCache as DjangoRedisCache
2
2
  from django_redis import cache, exceptions
3
3
 
4
4
  from django_prometheus.cache.metrics import (
@@ -33,20 +33,17 @@ class RedisCache(cache.RedisCache):
33
33
  return default
34
34
 
35
35
 
36
- if DJANGO_VERSION >= (4, 0):
37
- from django.core.cache.backends.redis import RedisCache as DjangoRedisCache
38
-
39
- class NativeRedisCache(DjangoRedisCache):
40
- def get(self, key, default=None, version=None):
41
- django_cache_get_total.labels(backend="native_redis").inc()
42
- try:
43
- result = super().get(key, default=None, version=version)
44
- except Exception:
45
- django_cache_get_fail_total.labels(backend="native_redis").inc()
46
- raise
47
- if result is not None:
48
- django_cache_hits_total.labels(backend="native_redis").inc()
49
- return result
50
- else:
51
- django_cache_misses_total.labels(backend="native_redis").inc()
52
- return default
36
+ class NativeRedisCache(DjangoRedisCache):
37
+ def get(self, key, default=None, version=None):
38
+ django_cache_get_total.labels(backend="native_redis").inc()
39
+ try:
40
+ result = super().get(key, default=None, version=version)
41
+ except Exception:
42
+ django_cache_get_fail_total.labels(backend="native_redis").inc()
43
+ raise
44
+ if result is not None:
45
+ django_cache_hits_total.labels(backend="native_redis").inc()
46
+ return result
47
+ else:
48
+ django_cache_misses_total.labels(backend="native_redis").inc()
49
+ return default
@@ -1,6 +1,6 @@
1
1
  from django.contrib.gis.db.backends.postgis import base
2
+ from django.db.backends.postgresql.base import Cursor
2
3
 
3
- from django_prometheus.db.backends.common import get_postgres_cursor_class
4
4
  from django_prometheus.db.common import DatabaseWrapperMixin, ExportingCursorWrapper
5
5
 
6
6
 
@@ -8,8 +8,11 @@ class DatabaseWrapper(DatabaseWrapperMixin, base.DatabaseWrapper):
8
8
  def get_new_connection(self, *args, **kwargs):
9
9
  conn = super().get_new_connection(*args, **kwargs)
10
10
  conn.cursor_factory = ExportingCursorWrapper(
11
- conn.cursor_factory or get_postgres_cursor_class(), "postgis", self.vendor
11
+ conn.cursor_factory or Cursor(),
12
+ "postgis",
13
+ self.vendor,
12
14
  )
15
+
13
16
  return conn
14
17
 
15
18
  def create_cursor(self, name=None):
@@ -1,6 +1,6 @@
1
1
  from django.db.backends.postgresql import base
2
+ from django.db.backends.postgresql.base import Cursor
2
3
 
3
- from django_prometheus.db.backends.common import get_postgres_cursor_class
4
4
  from django_prometheus.db.common import DatabaseWrapperMixin, ExportingCursorWrapper
5
5
 
6
6
 
@@ -8,8 +8,11 @@ class DatabaseWrapper(DatabaseWrapperMixin, base.DatabaseWrapper):
8
8
  def get_new_connection(self, *args, **kwargs):
9
9
  conn = super().get_new_connection(*args, **kwargs)
10
10
  conn.cursor_factory = ExportingCursorWrapper(
11
- conn.cursor_factory or get_postgres_cursor_class(), self.alias, self.vendor
11
+ conn.cursor_factory or Cursor(),
12
+ self.alias,
13
+ self.vendor,
12
14
  )
15
+
13
16
  return conn
14
17
 
15
18
  def create_cursor(self, name=None):
@@ -219,10 +219,10 @@ class PrometheusAfterMiddleware(MiddlewareMixin):
219
219
  self.label_metric(self.metrics.requests_by_transport, request, transport=transport).inc()
220
220
 
221
221
  # Mimic the behaviour of the deprecated "Request.is_ajax()" method.
222
- if request.META.get("HTTP_X_REQUESTED_WITH") == "XMLHttpRequest":
222
+ if request.headers.get("x-requested-with") == "XMLHttpRequest":
223
223
  self.label_metric(self.metrics.requests_ajax, request).inc()
224
224
 
225
- content_length = int(request.META.get("CONTENT_LENGTH") or 0)
225
+ content_length = int(request.headers.get("content-length") or 0)
226
226
  self.label_metric(self.metrics.requests_body_bytes, request).observe(content_length)
227
227
  request.prometheus_after_middleware_event = Time()
228
228
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-prometheus
3
- Version: 2.4.0.dev15
3
+ Version: 2.4.0.dev17
4
4
  Summary: Django middlewares to monitor your application with Prometheus.io.
5
5
  Home-page: http://github.com/korfuri/django-prometheus
6
6
  Author: Uriel Corfa
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.9
20
20
  Classifier: Programming Language :: Python :: 3.10
21
21
  Classifier: Programming Language :: Python :: 3.11
22
22
  Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
23
24
  Classifier: Framework :: Django :: 4.2
24
25
  Classifier: Framework :: Django :: 5.0
25
26
  Classifier: Framework :: Django :: 5.1
@@ -31,7 +31,6 @@ django_prometheus/db/__init__.py
31
31
  django_prometheus/db/common.py
32
32
  django_prometheus/db/metrics.py
33
33
  django_prometheus/db/backends/__init__.py
34
- django_prometheus/db/backends/common.py
35
34
  django_prometheus/db/backends/mysql/__init__.py
36
35
  django_prometheus/db/backends/mysql/base.py
37
36
  django_prometheus/db/backends/postgis/__init__.py
@@ -55,6 +55,7 @@ setup(
55
55
  "Programming Language :: Python :: 3.10",
56
56
  "Programming Language :: Python :: 3.11",
57
57
  "Programming Language :: Python :: 3.12",
58
+ "Programming Language :: Python :: 3.13",
58
59
  "Framework :: Django :: 4.2",
59
60
  "Framework :: Django :: 5.0",
60
61
  "Framework :: Django :: 5.1",
@@ -1,9 +0,0 @@
1
- from django import VERSION
2
-
3
-
4
- def get_postgres_cursor_class():
5
- if VERSION < (4, 2):
6
- from psycopg2.extensions import cursor as cursor_cls
7
- else:
8
- from django.db.backends.postgresql.base import Cursor as cursor_cls
9
- return cursor_cls