apitally 0.6.0__py3-none-any.whl → 0.6.2__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.
- apitally/__init__.py +1 -1
- apitally/client/base.py +11 -8
- apitally/litestar.py +1 -0
- {apitally-0.6.0.dist-info → apitally-0.6.2.dist-info}/METADATA +1 -1
- {apitally-0.6.0.dist-info → apitally-0.6.2.dist-info}/RECORD +7 -7
- {apitally-0.6.0.dist-info → apitally-0.6.2.dist-info}/LICENSE +0 -0
- {apitally-0.6.0.dist-info → apitally-0.6.2.dist-info}/WHEEL +0 -0
apitally/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.6.
|
1
|
+
__version__ = "0.6.2"
|
apitally/client/base.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
+
import contextlib
|
3
4
|
import os
|
4
5
|
import re
|
5
6
|
import threading
|
@@ -132,15 +133,17 @@ class RequestCounter:
|
|
132
133
|
self.request_counts[request_info] += 1
|
133
134
|
self.response_times.setdefault(request_info, Counter())[response_time_ms_bin] += 1
|
134
135
|
if request_size is not None:
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
136
|
+
with contextlib.suppress(ValueError):
|
137
|
+
request_size = int(request_size)
|
138
|
+
request_size_kb_bin = request_size // 1000 # In KB, rounded down to nearest 1KB
|
139
|
+
self.request_size_sums[request_info] += request_size
|
140
|
+
self.request_sizes.setdefault(request_info, Counter())[request_size_kb_bin] += 1
|
139
141
|
if response_size is not None:
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
142
|
+
with contextlib.suppress(ValueError):
|
143
|
+
response_size = int(response_size)
|
144
|
+
response_size_kb_bin = response_size // 1000 # In KB, rounded down to nearest 1KB
|
145
|
+
self.response_size_sums[request_info] += response_size
|
146
|
+
self.response_sizes.setdefault(request_info, Counter())[response_size_kb_bin] += 1
|
144
147
|
|
145
148
|
def get_and_reset_requests(self) -> List[Dict[str, Any]]:
|
146
149
|
data: List[Dict[str, Any]] = []
|
apitally/litestar.py
CHANGED
@@ -37,6 +37,7 @@ class ApitallyPlugin(InitPluginProtocol):
|
|
37
37
|
|
38
38
|
def on_app_init(self, app_config: AppConfig) -> AppConfig:
|
39
39
|
app_config.on_startup.append(self.on_startup)
|
40
|
+
app_config.on_shutdown.append(self.client.handle_shutdown)
|
40
41
|
app_config.middleware.append(self.middleware_factory)
|
41
42
|
return app_config
|
42
43
|
|
@@ -1,7 +1,7 @@
|
|
1
|
-
apitally/__init__.py,sha256=
|
1
|
+
apitally/__init__.py,sha256=jFlbxEJFS0G44LE-yXXVSwXACA1J_NyYDk5E20_2zpc,22
|
2
2
|
apitally/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
apitally/client/asyncio.py,sha256=uR5JlH37G6gZvAJ7A1gYOGkjn3zjC-4I6avA1fncXHs,4433
|
4
|
-
apitally/client/base.py,sha256=
|
4
|
+
apitally/client/base.py,sha256=E_yUTItAtZWPOx80K3Pm55CNBgF_NZ6RMyXZTnjSV9c,8511
|
5
5
|
apitally/client/logging.py,sha256=QMsKIIAFo92PNBUleeTgsrsQa7SEal-oJa1oOHUr1wI,507
|
6
6
|
apitally/client/threading.py,sha256=ihQzUStrSQFynpqXgFpseAXrHuc5Et1QvG-YHlzqDr8,4831
|
7
7
|
apitally/django.py,sha256=vL2vBelXis-9d3CDWjKzLsOjdSbBDnZX0v1oDtBvtNM,9943
|
@@ -9,10 +9,10 @@ apitally/django_ninja.py,sha256=iMvZd7j04nbOLpJgYxs7tpbsyXlZuhmHjcswXMvyUlU,82
|
|
9
9
|
apitally/django_rest_framework.py,sha256=iMvZd7j04nbOLpJgYxs7tpbsyXlZuhmHjcswXMvyUlU,82
|
10
10
|
apitally/fastapi.py,sha256=Q3n2bVREKQ_V_2yCQ48ngPtr-NJxDskpT_l20xhSbpM,85
|
11
11
|
apitally/flask.py,sha256=-R0MP72ufO3v0p30JBU9asODWtuOU3FOCl5iY-kTSzw,5099
|
12
|
-
apitally/litestar.py,sha256=
|
12
|
+
apitally/litestar.py,sha256=rOQE0gsqDifwZUw_SGMBB1KIV0oAh3ydiJWnpTTC2sI,7504
|
13
13
|
apitally/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
14
|
apitally/starlette.py,sha256=VlLWOR9rzNlI9IjFbQ86APaWanURerIt52tX6bRGzCo,7814
|
15
|
-
apitally-0.6.
|
16
|
-
apitally-0.6.
|
17
|
-
apitally-0.6.
|
18
|
-
apitally-0.6.
|
15
|
+
apitally-0.6.2.dist-info/LICENSE,sha256=vbLzC-4TddtXX-_AFEBKMYWRlxC_MN0g66QhPxo8PgY,1065
|
16
|
+
apitally-0.6.2.dist-info/METADATA,sha256=SfrcUwFe0P6PTr9fK1SwB6fyK_FduuTCQK22T8z_Uek,6610
|
17
|
+
apitally-0.6.2.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
18
|
+
apitally-0.6.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|