c2cwsgiutils 6.2.0.dev25__py3-none-any.whl → 6.2.0.dev27__py3-none-any.whl
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/debug/_views.py +20 -1
- {c2cwsgiutils-6.2.0.dev25.dist-info → c2cwsgiutils-6.2.0.dev27.dist-info}/METADATA +2 -1
- {c2cwsgiutils-6.2.0.dev25.dist-info → c2cwsgiutils-6.2.0.dev27.dist-info}/RECORD +6 -6
- {c2cwsgiutils-6.2.0.dev25.dist-info → c2cwsgiutils-6.2.0.dev27.dist-info}/LICENSE +0 -0
- {c2cwsgiutils-6.2.0.dev25.dist-info → c2cwsgiutils-6.2.0.dev27.dist-info}/WHEEL +0 -0
- {c2cwsgiutils-6.2.0.dev25.dist-info → c2cwsgiutils-6.2.0.dev27.dist-info}/entry_points.txt +0 -0
c2cwsgiutils/debug/_views.py
CHANGED
@@ -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:
|
@@ -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"
|
@@ -20,7 +20,7 @@ c2cwsgiutils/db.py,sha256=JT5F9Dqm2r0Jsh3w3CX79ngAUtakMLpf1secfN1nQnk,16106
|
|
20
20
|
c2cwsgiutils/db_maintenance_view.py,sha256=58F-p9drkhCI99GoLRPIqT5U-Pm8ckSSUEl-tNxMmjU,3088
|
21
21
|
c2cwsgiutils/debug/__init__.py,sha256=GkYNt2fU5PFykw9HmqPEwZrF2mTJumjSu54pp38EhOM,1325
|
22
22
|
c2cwsgiutils/debug/_listeners.py,sha256=RZYwQRh86rU-Vtjxc3xOZL2A8D_5LHIBd-xWAMQCrj0,4421
|
23
|
-
c2cwsgiutils/debug/_views.py,sha256=
|
23
|
+
c2cwsgiutils/debug/_views.py,sha256=rxvxxzSIiwfdRieGkR6BG4zGa3hd1e17r-GMoQOSzgM,8511
|
24
24
|
c2cwsgiutils/debug/utils.py,sha256=sIKZHQ8empzxE2OI3h7Uce8cvv4O7AD1y_VYeZfLVCA,2320
|
25
25
|
c2cwsgiutils/errors.py,sha256=-hWLQ1qDlh9kn06-33U2c39BbOxuCvJIkBkdxriE5mo,6644
|
26
26
|
c2cwsgiutils/health_check.py,sha256=OhfPcApBht1qtBOX8e8pdeq3QwF4FbgGkofjqpl8GvQ,20068
|
@@ -60,8 +60,8 @@ c2cwsgiutils/stats_pyramid/_db_spy.py,sha256=A61t6VKIrRRIjbyZTldmAUl_Q3ZDVFYqyxj
|
|
60
60
|
c2cwsgiutils/stats_pyramid/_pyramid_spy.py,sha256=mRiOmQXV9x8JjkGV4MsaC7sD3qO6dWUTog0bharLLD0,3517
|
61
61
|
c2cwsgiutils/templates/index.html.mako,sha256=Ey9ppHLe-eFGYXYPV5Z2WbMBSif86sYPiTviksnG7TI,1362
|
62
62
|
c2cwsgiutils/version.py,sha256=1ghPu-aKMJdfCSUrxgBENNqNQ-7JMKJr6tS14dDmW4Q,3110
|
63
|
-
c2cwsgiutils-6.2.0.
|
64
|
-
c2cwsgiutils-6.2.0.
|
65
|
-
c2cwsgiutils-6.2.0.
|
66
|
-
c2cwsgiutils-6.2.0.
|
67
|
-
c2cwsgiutils-6.2.0.
|
63
|
+
c2cwsgiutils-6.2.0.dev27.dist-info/LICENSE,sha256=r7ueGz9Fl2Bv3rmeQy0DEtohLmAiufRaCuv6Y5fyNhE,1304
|
64
|
+
c2cwsgiutils-6.2.0.dev27.dist-info/METADATA,sha256=FzdiFUvSshMPqfGefTnWFHwB6Gdd6OjOvRJHxOwGUjg,34461
|
65
|
+
c2cwsgiutils-6.2.0.dev27.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
66
|
+
c2cwsgiutils-6.2.0.dev27.dist-info/entry_points.txt,sha256=ujgqMTL1awN9qDg8WXmrF7m0fgR-hslUM6zKH86pvy0,703
|
67
|
+
c2cwsgiutils-6.2.0.dev27.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|