django-prometheus 2.6.0.dev3__tar.gz → 2.6.0.dev5__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.
- {django_prometheus-2.6.0.dev3/django_prometheus.egg-info → django_prometheus-2.6.0.dev5}/PKG-INFO +1 -1
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/__init__.py +1 -1
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/migrations.py +8 -7
- django_prometheus-2.6.0.dev5/django_prometheus/tests/test_utils.py +49 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5/django_prometheus.egg-info}/PKG-INFO +1 -1
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus.egg-info/SOURCES.txt +2 -1
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/LICENSE +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/MANIFEST.in +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/README.md +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/apps.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/cache/__init__.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/cache/backends/__init__.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/cache/backends/django_memcached_consul.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/cache/backends/filebased.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/cache/backends/locmem.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/cache/backends/memcached.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/cache/backends/redis.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/cache/metrics.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/conf/__init__.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/db/__init__.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/db/backends/__init__.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/db/backends/mysql/__init__.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/db/backends/mysql/base.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/db/backends/postgis/__init__.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/db/backends/postgis/base.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/db/backends/postgresql/__init__.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/db/backends/postgresql/base.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/db/backends/spatialite/__init__.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/db/backends/spatialite/base.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/db/backends/sqlite3/__init__.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/db/backends/sqlite3/base.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/db/common.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/db/metrics.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/exports.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/middleware.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/models.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/tests/__init__.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/tests/test_db_wrapper.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/tests/test_django_prometheus.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/tests/test_exports.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/tests/test_testutils.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/testutils.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/urls.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/utils.py +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus.egg-info/dependency_links.txt +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus.egg-info/requires.txt +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus.egg-info/top_level.txt +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/pyproject.toml +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/setup.cfg +0 -0
- {django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/setup.py +0 -0
{django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/migrations.py
RENAMED
|
@@ -38,13 +38,14 @@ def ExportMigrations():
|
|
|
38
38
|
# ready.
|
|
39
39
|
from django.db.migrations.executor import MigrationExecutor
|
|
40
40
|
|
|
41
|
-
if "default" in connections and (isinstance(connections["default"], DatabaseWrapper)):
|
|
42
|
-
# This is the case where DATABASES = {} in the configuration,
|
|
43
|
-
# i.e. the user is not using any databases. Django "helpfully"
|
|
44
|
-
# adds a dummy database and then throws when you try to
|
|
45
|
-
# actually use it. So we don't do anything, because trying to
|
|
46
|
-
# export stats would crash the app on startup.
|
|
47
|
-
return
|
|
48
41
|
for alias in connections.databases:
|
|
42
|
+
if alias == "default" and (isinstance(connections[alias], DatabaseWrapper)):
|
|
43
|
+
# This is the case where DATABASES = {} in the configuration,
|
|
44
|
+
# i.e. the user is not using any databases. Django "helpfully"
|
|
45
|
+
# adds a dummy database and then throws when you try to
|
|
46
|
+
# actually use it. So we don't do anything, because trying to
|
|
47
|
+
# export stats would crash the app on startup.
|
|
48
|
+
continue
|
|
49
|
+
|
|
49
50
|
executor = MigrationExecutor(connections[alias])
|
|
50
51
|
ExportMigrationsForDatabase(alias, executor)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
import time
|
|
3
|
+
|
|
4
|
+
from django_prometheus.utils import PowersOf, Time, TimeSince
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_time_value_is_usable_with_timesince():
|
|
8
|
+
"""Time() returns an opaque value TimeSince() turns into fractional seconds."""
|
|
9
|
+
elapsed = TimeSince(Time())
|
|
10
|
+
assert isinstance(elapsed, float)
|
|
11
|
+
assert elapsed >= 0
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_time_is_monotonic_nondecreasing():
|
|
15
|
+
"""Successive calls to Time() never go backwards."""
|
|
16
|
+
t1 = Time()
|
|
17
|
+
t2 = Time()
|
|
18
|
+
assert t2 >= t1
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_timesince_is_nonnegative_and_small_for_immediate_call():
|
|
22
|
+
"""TimeSince() of a just-captured Time() is a small, non-negative value."""
|
|
23
|
+
t = Time()
|
|
24
|
+
elapsed = TimeSince(t)
|
|
25
|
+
assert elapsed >= 0
|
|
26
|
+
assert elapsed < 1.0
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def test_timesince_measures_elapsed_time():
|
|
30
|
+
"""TimeSince() reflects the time that actually elapsed between the two calls."""
|
|
31
|
+
t = Time()
|
|
32
|
+
time.sleep(0.02)
|
|
33
|
+
assert TimeSince(t) >= 0.02
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_powersof_includes_zero_by_default():
|
|
37
|
+
"""PowersOf() prepends 0 and returns count powers of logbase."""
|
|
38
|
+
assert PowersOf(2, 4) == [0, 1, 2, 4, 8]
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def test_powersof_without_zero():
|
|
42
|
+
"""include_zero=False drops the leading 0."""
|
|
43
|
+
assert PowersOf(2, 4, include_zero=False) == [1, 2, 4, 8]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def test_powersof_with_lower_bound():
|
|
47
|
+
"""lower shifts the starting exponent."""
|
|
48
|
+
assert PowersOf(10, 3, lower=1, include_zero=False) == [10, 100, 1000]
|
|
49
|
+
assert PowersOf(10, 3, lower=1) == [0, 10, 100, 1000]
|
{django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus.egg-info/SOURCES.txt
RENAMED
|
@@ -45,4 +45,5 @@ django_prometheus/tests/__init__.py
|
|
|
45
45
|
django_prometheus/tests/test_db_wrapper.py
|
|
46
46
|
django_prometheus/tests/test_django_prometheus.py
|
|
47
47
|
django_prometheus/tests/test_exports.py
|
|
48
|
-
django_prometheus/tests/test_testutils.py
|
|
48
|
+
django_prometheus/tests/test_testutils.py
|
|
49
|
+
django_prometheus/tests/test_utils.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/cache/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/cache/metrics.py
RENAMED
|
File without changes
|
{django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/conf/__init__.py
RENAMED
|
File without changes
|
{django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/db/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/db/common.py
RENAMED
|
File without changes
|
{django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/db/metrics.py
RENAMED
|
File without changes
|
|
File without changes
|
{django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/middleware.py
RENAMED
|
File without changes
|
|
File without changes
|
{django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/tests/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_prometheus-2.6.0.dev3 → django_prometheus-2.6.0.dev5}/django_prometheus/testutils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|