c2cwsgiutils 6.2.0.dev23__tar.gz → 6.2.0.dev27__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.
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/PKG-INFO +2 -1
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/debug/_views.py +31 -5
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/pyproject.toml +4 -2
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/LICENSE +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/README.md +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/acceptance/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/acceptance/connection.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/acceptance/image.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/acceptance/package-lock.json +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/acceptance/package.json +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/acceptance/print.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/acceptance/screenshot.js +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/acceptance/utils.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/auth.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/broadcast/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/broadcast/interface.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/broadcast/local.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/broadcast/redis.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/broadcast/utils.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/client_info.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/config_utils.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/coverage_setup.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/db.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/db_maintenance_view.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/debug/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/debug/_listeners.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/debug/utils.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/errors.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/health_check.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/index.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/loader.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/logging_view.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/models_graph.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/pretty_json.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/profiler.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/prometheus.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/py.typed +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/pyramid.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/pyramid_logging.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/redis_stats.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/redis_utils.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/request_tracking/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/request_tracking/_sql.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/scripts/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/scripts/genversion.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/scripts/stats_db.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/scripts/test_print.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/sentry.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/services.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/setup_process.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/sql_profiler/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/sql_profiler/_impl.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/sqlalchemylogger/README.md +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/sqlalchemylogger/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/sqlalchemylogger/_filters.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/sqlalchemylogger/_models.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/sqlalchemylogger/examples/example.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/sqlalchemylogger/handlers.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/static/favicon-16x16.png +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/static/favicon-32x32.png +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/stats_pyramid/__init__.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/stats_pyramid/_db_spy.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/stats_pyramid/_pyramid_spy.py +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/templates/index.html.mako +0 -0
- {c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/version.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: c2cwsgiutils
|
3
|
-
Version: 6.2.0.
|
3
|
+
Version: 6.2.0.dev27
|
4
4
|
Summary: Common utilities for Camptocamp WSGI applications
|
5
5
|
Home-page: https://github.com/camptocamp/c2cwsgiutils
|
6
6
|
License: BSD-2-Clause
|
@@ -44,6 +44,7 @@ Requires-Dist: gunicorn ; extra == "standard" or extra == "webserver" or extra =
|
|
44
44
|
Requires-Dist: lxml ; extra == "tests" or extra == "all"
|
45
45
|
Requires-Dist: objgraph ; extra == "debug" or extra == "all"
|
46
46
|
Requires-Dist: prometheus-client ; extra == "standard" or extra == "webserver" or extra == "all"
|
47
|
+
Requires-Dist: psutil ; extra == "debug" or extra == "all"
|
47
48
|
Requires-Dist: psycopg2 ; extra == "standard" or extra == "webserver" or extra == "all"
|
48
49
|
Requires-Dist: pyjwt ; extra == "standard" or extra == "oauth2" or extra == "all"
|
49
50
|
Requires-Dist: pyramid ; extra == "standard" or extra == "webserver" or extra == "all"
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import gc
|
2
2
|
import logging
|
3
|
+
import os
|
3
4
|
import re
|
4
5
|
import time
|
5
6
|
from collections.abc import Mapping
|
@@ -8,6 +9,7 @@ from io import StringIO
|
|
8
9
|
from typing import Any, Callable, cast
|
9
10
|
|
10
11
|
import objgraph
|
12
|
+
import psutil
|
11
13
|
import pyramid.config
|
12
14
|
import pyramid.request
|
13
15
|
import pyramid.response
|
@@ -87,6 +89,9 @@ def _dump_memory_diff(request: pyramid.request.Request) -> list[Any]:
|
|
87
89
|
gc.collect(i)
|
88
90
|
|
89
91
|
objgraph.growth(limit=limit, peak_stats=peak_stats, shortnames=False)
|
92
|
+
process = psutil.Process(os.getpid())
|
93
|
+
mem_before = process.memory_info()
|
94
|
+
start_time = time.time()
|
90
95
|
|
91
96
|
response = None
|
92
97
|
try:
|
@@ -96,12 +101,26 @@ def _dump_memory_diff(request: pyramid.request.Request) -> list[Any]:
|
|
96
101
|
except HTTPException as ex:
|
97
102
|
_LOG.debug("response was %s", str(ex))
|
98
103
|
|
104
|
+
elapsed_time = time.time() - start_time
|
99
105
|
del response
|
100
106
|
|
101
107
|
for i in range(3):
|
102
108
|
gc.collect(i)
|
103
109
|
|
104
|
-
|
110
|
+
mem_after = process.memory_info()
|
111
|
+
return {
|
112
|
+
"memory.growth": {
|
113
|
+
"rss_kb": (mem_after.rss - mem_before.rss) / 1024,
|
114
|
+
"vms_kb": (mem_after.vms - mem_before.vms) / 1024,
|
115
|
+
"shared_kb": (mem_after.shared - mem_before.shared) / 1024,
|
116
|
+
"text_kb": (mem_after.text - mem_before.text) / 1024,
|
117
|
+
"lib_kb": (mem_after.lib - mem_before.lib) / 1024,
|
118
|
+
"data_kb": (mem_after.data - mem_before.data) / 1024,
|
119
|
+
"dirty_kb": (mem_after.dirty - mem_before.dirty) / 1024,
|
120
|
+
},
|
121
|
+
"elapsed_time": elapsed_time,
|
122
|
+
"objgraph.growth": objgraph.growth(limit=limit, peak_stats=peak_stats, shortnames=False), # type: ignore
|
123
|
+
}
|
105
124
|
|
106
125
|
|
107
126
|
def _sleep(request: pyramid.request.Request) -> pyramid.response.Response:
|
@@ -189,10 +208,17 @@ def _show_refs(request: pyramid.request.Request) -> pyramid.response.Response:
|
|
189
208
|
args["extra_info"] = lambda obj: f"{get_size(obj) / 1024:.3f} kb\n{id(obj)}"
|
190
209
|
|
191
210
|
result = StringIO()
|
192
|
-
if request.params.get("backrefs", "")
|
193
|
-
|
194
|
-
|
195
|
-
|
211
|
+
if request.params.get("backrefs", "") == "":
|
212
|
+
|
213
|
+
def new_filter(x: Any) -> bool:
|
214
|
+
return not objgraph.inspect.isclass(x)
|
215
|
+
|
216
|
+
if "filter" in args:
|
217
|
+
old_filter = args["filter"]
|
218
|
+
args["filter"] = lambda x: old_filter(x) and new_filter(x)
|
219
|
+
else:
|
220
|
+
args["filter"] = new_filter
|
221
|
+
objgraph.show_backrefs(objs, output=result, **args)
|
196
222
|
|
197
223
|
request.response.content_type = "text/vnd.graphviz"
|
198
224
|
request.response.text = result.getvalue()
|
@@ -16,7 +16,7 @@ strict = true
|
|
16
16
|
|
17
17
|
[tool.poetry]
|
18
18
|
name = "c2cwsgiutils"
|
19
|
-
version = "6.2.0.
|
19
|
+
version = "6.2.0.dev27"
|
20
20
|
description = "Common utilities for Camptocamp WSGI applications"
|
21
21
|
readme = "README.md"
|
22
22
|
authors = ["Camptocamp <info@camptocamp.com>"]
|
@@ -92,6 +92,7 @@ waitress = { version = "3.0.1", optional = true }
|
|
92
92
|
scikit-image = { version = "0.24.0", optional = true }
|
93
93
|
prometheus-client = { version = "0.21.0", optional = true}
|
94
94
|
pyramid_mako = { version = "1.1.0", optional = true}
|
95
|
+
psutil = { version = "6.1.0", optional = true}
|
95
96
|
|
96
97
|
[tool.poetry.extras]
|
97
98
|
standard = [
|
@@ -118,7 +119,7 @@ standard = [
|
|
118
119
|
"pyramid_mako",
|
119
120
|
]
|
120
121
|
alembic = ["alembic"]
|
121
|
-
debug = ["objgraph"]
|
122
|
+
debug = ["objgraph", "psutil"]
|
122
123
|
oauth2 = ["pyjwt", "requests-oauthlib"]
|
123
124
|
sentry = ["sentry-sdk"]
|
124
125
|
dev = ["waitress"]
|
@@ -141,6 +142,7 @@ all = [
|
|
141
142
|
"alembic",
|
142
143
|
# debug
|
143
144
|
"objgraph",
|
145
|
+
"psutil",
|
144
146
|
# oauth2
|
145
147
|
"pyjwt",
|
146
148
|
"requests-oauthlib",
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/acceptance/package-lock.json
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
|
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
|
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
|
{c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/request_tracking/__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
|
{c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/sqlalchemylogger/README.md
RENAMED
File without changes
|
{c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/sqlalchemylogger/__init__.py
RENAMED
File without changes
|
{c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/sqlalchemylogger/_filters.py
RENAMED
File without changes
|
{c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/sqlalchemylogger/_models.py
RENAMED
File without changes
|
File without changes
|
{c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/sqlalchemylogger/handlers.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/stats_pyramid/__init__.py
RENAMED
File without changes
|
File without changes
|
{c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/stats_pyramid/_pyramid_spy.py
RENAMED
File without changes
|
{c2cwsgiutils-6.2.0.dev23 → c2cwsgiutils-6.2.0.dev27}/c2cwsgiutils/templates/index.html.mako
RENAMED
File without changes
|
File without changes
|