swarmauri_middleware_time 0.8.0.dev47__tar.gz → 0.11.0.dev1__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.
- {swarmauri_middleware_time-0.8.0.dev47 → swarmauri_middleware_time-0.11.0.dev1}/PKG-INFO +18 -21
- {swarmauri_middleware_time-0.8.0.dev47 → swarmauri_middleware_time-0.11.0.dev1}/README.md +11 -15
- {swarmauri_middleware_time-0.8.0.dev47 → swarmauri_middleware_time-0.11.0.dev1}/pyproject.toml +8 -7
- {swarmauri_middleware_time-0.8.0.dev47 → swarmauri_middleware_time-0.11.0.dev1}/swarmauri_middleware_time/TimerMiddleware.py +15 -4
- {swarmauri_middleware_time-0.8.0.dev47 → swarmauri_middleware_time-0.11.0.dev1}/LICENSE +0 -0
- {swarmauri_middleware_time-0.8.0.dev47 → swarmauri_middleware_time-0.11.0.dev1}/swarmauri_middleware_time/__init__.py +0 -0
|
@@ -1,50 +1,45 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: swarmauri_middleware_time
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.0.dev1
|
|
4
4
|
Summary: Middleware for tracking request processing time in Swarmauri applications
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
7
7
|
Keywords: swarmauri,sdk,standards,middleware,time
|
|
8
8
|
Author: Jacob Stewart
|
|
9
9
|
Author-email: jacob@swarmauri.com
|
|
10
|
-
Requires-Python: >=3.10,<3.
|
|
10
|
+
Requires-Python: >=3.10,<3.15
|
|
11
11
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
12
|
Classifier: Natural Language :: English
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
17
13
|
Classifier: Development Status :: 3 - Alpha
|
|
18
14
|
Classifier: Programming Language :: Python
|
|
19
15
|
Classifier: Programming Language :: Python :: 3
|
|
20
16
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
22
|
Requires-Dist: fastapi
|
|
22
23
|
Requires-Dist: swarmauri_base
|
|
23
24
|
Requires-Dist: swarmauri_core
|
|
24
25
|
Requires-Dist: swarmauri_standard
|
|
25
26
|
Description-Content-Type: text/markdown
|
|
26
27
|
|
|
27
|
-

|
|
28
29
|
|
|
29
30
|
<p align="center">
|
|
30
|
-
<a href="https://
|
|
31
|
-
<img src="https://
|
|
32
|
-
</a>
|
|
31
|
+
<a href="https://pepy.tech/project/swarmauri_middleware_time/">
|
|
32
|
+
<img src="https://static.pepy.tech/badge/swarmauri_middleware_time/month" alt="PyPI - Downloads"/></a>
|
|
33
33
|
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_middleware_time/">
|
|
34
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_middleware_time.svg"
|
|
35
|
-
</a>
|
|
34
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_middleware_time.svg"/></a>
|
|
36
35
|
<a href="https://pypi.org/project/swarmauri_middleware_time/">
|
|
37
|
-
<img src="https://img.shields.io/
|
|
38
|
-
</a>
|
|
36
|
+
<img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
|
|
39
37
|
<a href="https://pypi.org/project/swarmauri_middleware_time/">
|
|
40
|
-
<img src="https://img.shields.io/pypi/l/swarmauri_middleware_time" alt="PyPI - License"
|
|
41
|
-
</a>
|
|
38
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_middleware_time" alt="PyPI - License"/></a>
|
|
42
39
|
<a href="https://pypi.org/project/swarmauri_middleware_time/">
|
|
43
|
-
<img src="https://img.shields.io/pypi/v/swarmauri_middleware_time?label=swarmauri_middleware_time&color=green" alt="PyPI - swarmauri_middleware_time"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
---
|
|
40
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_middleware_time?label=swarmauri_middleware_time&color=green" alt="PyPI - swarmauri_middleware_time"/></a>
|
|
41
|
+
<a href="https://discord.gg/N4UpBuQv8T">
|
|
42
|
+
<img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
|
|
48
43
|
|
|
49
44
|
# Swarmauri Middleware Time
|
|
50
45
|
|
|
@@ -125,3 +120,5 @@ if __name__ == "__main__":
|
|
|
125
120
|
|
|
126
121
|
If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.
|
|
127
122
|
|
|
123
|
+
|
|
124
|
+
|
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-

|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<a href="https://
|
|
5
|
-
<img src="https://
|
|
6
|
-
</a>
|
|
4
|
+
<a href="https://pepy.tech/project/swarmauri_middleware_time/">
|
|
5
|
+
<img src="https://static.pepy.tech/badge/swarmauri_middleware_time/month" alt="PyPI - Downloads"/></a>
|
|
7
6
|
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_middleware_time/">
|
|
8
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_middleware_time.svg"
|
|
9
|
-
</a>
|
|
7
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_middleware_time.svg"/></a>
|
|
10
8
|
<a href="https://pypi.org/project/swarmauri_middleware_time/">
|
|
11
|
-
<img src="https://img.shields.io/
|
|
12
|
-
</a>
|
|
9
|
+
<img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
|
|
13
10
|
<a href="https://pypi.org/project/swarmauri_middleware_time/">
|
|
14
|
-
<img src="https://img.shields.io/pypi/l/swarmauri_middleware_time" alt="PyPI - License"
|
|
15
|
-
</a>
|
|
11
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_middleware_time" alt="PyPI - License"/></a>
|
|
16
12
|
<a href="https://pypi.org/project/swarmauri_middleware_time/">
|
|
17
|
-
<img src="https://img.shields.io/pypi/v/swarmauri_middleware_time?label=swarmauri_middleware_time&color=green" alt="PyPI - swarmauri_middleware_time"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
---
|
|
13
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_middleware_time?label=swarmauri_middleware_time&color=green" alt="PyPI - swarmauri_middleware_time"/></a>
|
|
14
|
+
<a href="https://discord.gg/N4UpBuQv8T">
|
|
15
|
+
<img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
|
|
22
16
|
|
|
23
17
|
# Swarmauri Middleware Time
|
|
24
18
|
|
|
@@ -98,3 +92,5 @@ if __name__ == "__main__":
|
|
|
98
92
|
## Want to help?
|
|
99
93
|
|
|
100
94
|
If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.
|
|
95
|
+
|
|
96
|
+
|
{swarmauri_middleware_time-0.8.0.dev47 → swarmauri_middleware_time-0.11.0.dev1}/pyproject.toml
RENAMED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "swarmauri_middleware_time"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.11.0.dev1"
|
|
4
4
|
description = "Middleware for tracking request processing time in Swarmauri applications"
|
|
5
5
|
license = "Apache-2.0"
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
repository = "http://github.com/swarmauri/swarmauri-sdk/pkgs/pkgs/swarmauri_middleware_time/"
|
|
8
|
-
requires-python = ">=3.10,<3.
|
|
8
|
+
requires-python = ">=3.10,<3.15"
|
|
9
9
|
classifiers = [
|
|
10
10
|
"License :: OSI Approved :: Apache Software License",
|
|
11
11
|
"Natural Language :: English",
|
|
12
|
-
"Programming Language :: Python :: 3.10",
|
|
13
|
-
"Programming Language :: Python :: 3.11",
|
|
14
|
-
"Programming Language :: Python :: 3.12",
|
|
15
|
-
"Programming Language :: Python :: 3.13",
|
|
16
12
|
"Development Status :: 3 - Alpha",
|
|
17
13
|
"Programming Language :: Python",
|
|
18
14
|
"Programming Language :: Python :: 3",
|
|
19
15
|
"Programming Language :: Python :: 3 :: Only",
|
|
16
|
+
"Programming Language :: Python :: 3.10",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Programming Language :: Python :: 3.14",
|
|
20
21
|
]
|
|
21
22
|
authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
|
|
22
23
|
dependencies = [
|
|
@@ -72,7 +73,7 @@ dev = [
|
|
|
72
73
|
"pytest-json-report>=1.5.0",
|
|
73
74
|
"pytest-mock>=3.12.0",
|
|
74
75
|
"python-dotenv",
|
|
75
|
-
"
|
|
76
|
+
"httpx>=0.27",
|
|
76
77
|
"flake8>=7.0",
|
|
77
78
|
"pytest-timeout>=2.3.1",
|
|
78
79
|
"ruff>=0.9.9",
|
|
@@ -25,7 +25,9 @@ class TimerMiddleware(MiddlewareBase, ComponentBase):
|
|
|
25
25
|
async def dispatch(
|
|
26
26
|
self, request: Request, call_next: Callable[[Request], Any]
|
|
27
27
|
) -> Any:
|
|
28
|
-
"""
|
|
28
|
+
"""
|
|
29
|
+
Dispatches the request to the next middleware in the chain while
|
|
30
|
+
tracking time.
|
|
29
31
|
|
|
30
32
|
This method measures the time taken for processing the request
|
|
31
33
|
from start to finish. It logs the start time, processes the
|
|
@@ -47,7 +49,10 @@ class TimerMiddleware(MiddlewareBase, ComponentBase):
|
|
|
47
49
|
# Record the start time of the request
|
|
48
50
|
start_time = time.time()
|
|
49
51
|
_LOGGER.info(
|
|
50
|
-
|
|
52
|
+
(
|
|
53
|
+
f"Request {request.method} {request.url.path} started at "
|
|
54
|
+
f"{start_time}"
|
|
55
|
+
)
|
|
51
56
|
)
|
|
52
57
|
|
|
53
58
|
try:
|
|
@@ -56,14 +61,20 @@ class TimerMiddleware(MiddlewareBase, ComponentBase):
|
|
|
56
61
|
except Exception as e:
|
|
57
62
|
# Log any exceptions that occur during processing
|
|
58
63
|
_LOGGER.error(
|
|
59
|
-
|
|
64
|
+
(
|
|
65
|
+
f"Error processing request {request.method} "
|
|
66
|
+
f"{request.url.path}: {str(e)}"
|
|
67
|
+
)
|
|
60
68
|
)
|
|
61
69
|
raise HTTPException(status_code=500, detail=str(e))
|
|
62
70
|
|
|
63
71
|
# Calculate the total time taken
|
|
64
72
|
total_time = time.time() - start_time
|
|
65
73
|
_LOGGER.info(
|
|
66
|
-
|
|
74
|
+
(
|
|
75
|
+
f"Request {request.method} {request.url.path} completed in "
|
|
76
|
+
f"{total_time:.4f} seconds"
|
|
77
|
+
)
|
|
67
78
|
)
|
|
68
79
|
|
|
69
80
|
# Fix: Add timing headers to the response
|
|
File without changes
|