mod-wsgi-telemetry 1.0.0.dev2__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.
- mod_wsgi_telemetry-1.0.0.dev2/.gitignore +55 -0
- mod_wsgi_telemetry-1.0.0.dev2/LICENSE +202 -0
- mod_wsgi_telemetry-1.0.0.dev2/PKG-INFO +79 -0
- mod_wsgi_telemetry-1.0.0.dev2/README-telemetry.rst +47 -0
- mod_wsgi_telemetry-1.0.0.dev2/README.md +166 -0
- mod_wsgi_telemetry-1.0.0.dev2/pyproject.toml +64 -0
- mod_wsgi_telemetry-1.0.0.dev2/src/mod_wsgi/__init__.py +2 -0
- mod_wsgi_telemetry-1.0.0.dev2/src/mod_wsgi/telemetry/__init__.py +1 -0
- mod_wsgi_telemetry-1.0.0.dev2/src/mod_wsgi/telemetry/cli.py +55 -0
- mod_wsgi_telemetry-1.0.0.dev2/src/mod_wsgi/telemetry/contention.py +229 -0
- mod_wsgi_telemetry-1.0.0.dev2/src/mod_wsgi/telemetry/dump.py +102 -0
- mod_wsgi_telemetry-1.0.0.dev2/src/mod_wsgi/telemetry/ingest.py +773 -0
- mod_wsgi_telemetry-1.0.0.dev2/src/mod_wsgi/telemetry/server.py +270 -0
- mod_wsgi_telemetry-1.0.0.dev2/src/mod_wsgi/telemetry/simulate.py +649 -0
- mod_wsgi_telemetry-1.0.0.dev2/src/mod_wsgi/telemetry/static/index.html +8368 -0
- mod_wsgi_telemetry-1.0.0.dev2/src/mod_wsgi/telemetry/tui.py +1536 -0
- mod_wsgi_telemetry-1.0.0.dev2/src/mod_wsgi/telemetry/wire.py +480 -0
- mod_wsgi_telemetry-1.0.0.dev2/tests/test_wire.py +353 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Autoconf/Automake build system
|
|
2
|
+
autom4te.cache
|
|
3
|
+
config.log
|
|
4
|
+
config.status
|
|
5
|
+
configure~
|
|
6
|
+
configure.ac~
|
|
7
|
+
Makefile
|
|
8
|
+
|
|
9
|
+
# Libtool artifacts
|
|
10
|
+
libtool
|
|
11
|
+
.libs
|
|
12
|
+
*.la
|
|
13
|
+
*.lo
|
|
14
|
+
*.loT
|
|
15
|
+
*.slo
|
|
16
|
+
|
|
17
|
+
# Compiled objects and shared libraries
|
|
18
|
+
*.o
|
|
19
|
+
*.so
|
|
20
|
+
|
|
21
|
+
# Python build and packaging
|
|
22
|
+
build
|
|
23
|
+
dist
|
|
24
|
+
*.egg-info
|
|
25
|
+
apxs_config.py
|
|
26
|
+
|
|
27
|
+
# Python bytecode
|
|
28
|
+
*.pyc
|
|
29
|
+
__pycache__
|
|
30
|
+
|
|
31
|
+
# Python virtual environments
|
|
32
|
+
.Python
|
|
33
|
+
venv
|
|
34
|
+
.venv
|
|
35
|
+
bin
|
|
36
|
+
include
|
|
37
|
+
lib
|
|
38
|
+
|
|
39
|
+
# Testing
|
|
40
|
+
.tox
|
|
41
|
+
.pytest_cache
|
|
42
|
+
httpd-test*
|
|
43
|
+
httpd-benchmark
|
|
44
|
+
|
|
45
|
+
# Documentation build output
|
|
46
|
+
docs/_build/
|
|
47
|
+
|
|
48
|
+
# Editor swap files
|
|
49
|
+
*.swp
|
|
50
|
+
|
|
51
|
+
# Third-party / vendored packages
|
|
52
|
+
src/packages
|
|
53
|
+
|
|
54
|
+
# Bundled Apache tools
|
|
55
|
+
apxs
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mod_wsgi-telemetry
|
|
3
|
+
Version: 1.0.0.dev2
|
|
4
|
+
Summary: Ingestion service and live UI for mod_wsgi telemetry samples.
|
|
5
|
+
Project-URL: Homepage, https://www.modwsgi.org/
|
|
6
|
+
Project-URL: Documentation, https://modwsgi.readthedocs.io/en/latest/user-guides/external-telemetry-service.html
|
|
7
|
+
Project-URL: Source, https://github.com/GrahamDumpleton/mod_wsgi
|
|
8
|
+
Project-URL: Issues, https://github.com/GrahamDumpleton/mod_wsgi/issues
|
|
9
|
+
Author-email: Graham Dumpleton <Graham.Dumpleton@gmail.com>
|
|
10
|
+
Maintainer-email: Graham Dumpleton <Graham.Dumpleton@gmail.com>
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: apache,mod_wsgi,monitoring,telemetry,wsgi
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
16
|
+
Classifier: Operating System :: POSIX
|
|
17
|
+
Classifier: Operating System :: POSIX :: BSD
|
|
18
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
19
|
+
Classifier: Programming Language :: Python
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
26
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
|
|
27
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Server
|
|
28
|
+
Classifier: Topic :: System :: Monitoring
|
|
29
|
+
Requires-Python: >=3.10
|
|
30
|
+
Requires-Dist: aiohttp>=3.9
|
|
31
|
+
Description-Content-Type: text/x-rst
|
|
32
|
+
|
|
33
|
+
Overview
|
|
34
|
+
--------
|
|
35
|
+
|
|
36
|
+
The ``mod_wsgi-telemetry`` package provides an external telemetry
|
|
37
|
+
ingester and live UI for the mod_wsgi Apache module. With the
|
|
38
|
+
``WSGITelemetryService`` directive enabled in Apache, each mod_wsgi
|
|
39
|
+
process (daemon-mode worker or embedded-mode Apache child) emits
|
|
40
|
+
per-interval binary datagrams summarising its throughput, latency
|
|
41
|
+
distribution, capacity utilisation, CPU and memory consumption, and
|
|
42
|
+
any active slow requests. The ingester receives those datagrams over
|
|
43
|
+
a local UNIX socket, aggregates them across every reporting process,
|
|
44
|
+
and serves a browser-based live UI together with a curses terminal
|
|
45
|
+
monitor for hosts where opening a browser is impractical.
|
|
46
|
+
|
|
47
|
+
The package is distributed separately from ``mod_wsgi`` itself so
|
|
48
|
+
that an installation using the operating-system ``mod_wsgi`` package,
|
|
49
|
+
or any other manually-configured Apache, can use the telemetry
|
|
50
|
+
pipeline without adopting the PyPi ``mod_wsgi`` or
|
|
51
|
+
``mod_wsgi-express`` packages.
|
|
52
|
+
|
|
53
|
+
The ingester is intended to run co-located with the Apache instance
|
|
54
|
+
it observes: the transport is a local UNIX datagram socket, and the
|
|
55
|
+
UI binds to the loopback interface by default. For remote access,
|
|
56
|
+
either an SSH tunnel or an authenticated reverse proxy is
|
|
57
|
+
recommended.
|
|
58
|
+
|
|
59
|
+
Once installed, launch the ingester with::
|
|
60
|
+
|
|
61
|
+
mod_wsgi-telemetry serve
|
|
62
|
+
|
|
63
|
+
It binds ``unix:/tmp/mod_wsgi-telemetry.sock`` for incoming
|
|
64
|
+
datagrams and serves the browser UI on ``http://127.0.0.1:8888/`` by
|
|
65
|
+
default. A ``mod_wsgi-telemetry top`` subcommand provides a
|
|
66
|
+
curses-based terminal monitor for the same data.
|
|
67
|
+
|
|
68
|
+
For the full configuration reference, including the
|
|
69
|
+
``WSGITelemetryService``, ``WSGITelemetryOptions`` and
|
|
70
|
+
``WSGISlowRequests`` Apache directives, the matching
|
|
71
|
+
``mod_wsgi-express`` options, socket-permission handling for
|
|
72
|
+
multi-user deployments, and the remote-access patterns, see the
|
|
73
|
+
External Telemetry Service page in the mod_wsgi documentation site
|
|
74
|
+
at https://www.modwsgi.org.
|
|
75
|
+
|
|
76
|
+
This package is still being iterated on. The directive set, option
|
|
77
|
+
names, wire format and ingester CLI may change in a future release;
|
|
78
|
+
pair an ingester release with the matching mod_wsgi release until
|
|
79
|
+
the pipeline stabilises.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Overview
|
|
2
|
+
--------
|
|
3
|
+
|
|
4
|
+
The ``mod_wsgi-telemetry`` package provides an external telemetry
|
|
5
|
+
ingester and live UI for the mod_wsgi Apache module. With the
|
|
6
|
+
``WSGITelemetryService`` directive enabled in Apache, each mod_wsgi
|
|
7
|
+
process (daemon-mode worker or embedded-mode Apache child) emits
|
|
8
|
+
per-interval binary datagrams summarising its throughput, latency
|
|
9
|
+
distribution, capacity utilisation, CPU and memory consumption, and
|
|
10
|
+
any active slow requests. The ingester receives those datagrams over
|
|
11
|
+
a local UNIX socket, aggregates them across every reporting process,
|
|
12
|
+
and serves a browser-based live UI together with a curses terminal
|
|
13
|
+
monitor for hosts where opening a browser is impractical.
|
|
14
|
+
|
|
15
|
+
The package is distributed separately from ``mod_wsgi`` itself so
|
|
16
|
+
that an installation using the operating-system ``mod_wsgi`` package,
|
|
17
|
+
or any other manually-configured Apache, can use the telemetry
|
|
18
|
+
pipeline without adopting the PyPi ``mod_wsgi`` or
|
|
19
|
+
``mod_wsgi-express`` packages.
|
|
20
|
+
|
|
21
|
+
The ingester is intended to run co-located with the Apache instance
|
|
22
|
+
it observes: the transport is a local UNIX datagram socket, and the
|
|
23
|
+
UI binds to the loopback interface by default. For remote access,
|
|
24
|
+
either an SSH tunnel or an authenticated reverse proxy is
|
|
25
|
+
recommended.
|
|
26
|
+
|
|
27
|
+
Once installed, launch the ingester with::
|
|
28
|
+
|
|
29
|
+
mod_wsgi-telemetry serve
|
|
30
|
+
|
|
31
|
+
It binds ``unix:/tmp/mod_wsgi-telemetry.sock`` for incoming
|
|
32
|
+
datagrams and serves the browser UI on ``http://127.0.0.1:8888/`` by
|
|
33
|
+
default. A ``mod_wsgi-telemetry top`` subcommand provides a
|
|
34
|
+
curses-based terminal monitor for the same data.
|
|
35
|
+
|
|
36
|
+
For the full configuration reference, including the
|
|
37
|
+
``WSGITelemetryService``, ``WSGITelemetryOptions`` and
|
|
38
|
+
``WSGISlowRequests`` Apache directives, the matching
|
|
39
|
+
``mod_wsgi-express`` options, socket-permission handling for
|
|
40
|
+
multi-user deployments, and the remote-access patterns, see the
|
|
41
|
+
External Telemetry Service page in the mod_wsgi documentation site
|
|
42
|
+
at https://www.modwsgi.org.
|
|
43
|
+
|
|
44
|
+
This package is still being iterated on. The directive set, option
|
|
45
|
+
names, wire format and ingester CLI may change in a future release;
|
|
46
|
+
pair an ingester release with the matching mod_wsgi release until
|
|
47
|
+
the pipeline stabilises.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# mod_wsgi-telemetry
|
|
2
|
+
|
|
3
|
+
Source directory for the `mod_wsgi-telemetry` PyPi package: the
|
|
4
|
+
external telemetry ingester and live UI for the
|
|
5
|
+
[mod_wsgi](https://www.modwsgi.org) Apache module.
|
|
6
|
+
|
|
7
|
+
User-facing documentation lives on the mod_wsgi docs site, on the
|
|
8
|
+
**External Telemetry Service** page. That page covers what the
|
|
9
|
+
service is, how to enable it in Apache (both manually and via
|
|
10
|
+
`mod_wsgi-express`), how to run the ingester in production
|
|
11
|
+
including a systemd unit and socket-permission handling for
|
|
12
|
+
multi-user deployments, and the remote-access patterns (SSH
|
|
13
|
+
tunnel, Apache reverse proxy). Start there for setup:
|
|
14
|
+
|
|
15
|
+
https://www.modwsgi.org
|
|
16
|
+
|
|
17
|
+
This README is for developers running the package from source,
|
|
18
|
+
debugging the wire format, exercising the UI without a running
|
|
19
|
+
mod_wsgi, or contributing changes.
|
|
20
|
+
|
|
21
|
+
## Running from source
|
|
22
|
+
|
|
23
|
+
The project is `uv`-managed:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
cd telemetry
|
|
27
|
+
uv sync
|
|
28
|
+
uv run mod_wsgi-telemetry serve
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
That starts the ingester on `unix:/tmp/mod_wsgi-telemetry.sock`
|
|
32
|
+
and the UI on `http://127.0.0.1:8888/`. A bare
|
|
33
|
+
`mod_wsgi-telemetry` invocation defaults to `serve`; the four
|
|
34
|
+
subcommands are:
|
|
35
|
+
|
|
36
|
+
| Subcommand | Purpose |
|
|
37
|
+
|---|---|
|
|
38
|
+
| `serve` | Production ingester + HTTP/WebSocket UI. |
|
|
39
|
+
| `top` | Curses terminal monitor; connects to a running `serve` instance. |
|
|
40
|
+
| `dump` | Bind the listening socket directly and print decoded datagrams. |
|
|
41
|
+
| `simulate` | Send synthetic samples to a running ingester for UI development. |
|
|
42
|
+
|
|
43
|
+
`serve` and `top` are covered by the user guide; `dump` and
|
|
44
|
+
`simulate` are development tools and covered below.
|
|
45
|
+
|
|
46
|
+
## `dump`: inspect wire-format datagrams
|
|
47
|
+
|
|
48
|
+
`dump` confirms that the C side of mod_wsgi is emitting the binary
|
|
49
|
+
format the ingester expects. It binds the listening socket itself,
|
|
50
|
+
so do not run it alongside `serve`; the two would fight for the
|
|
51
|
+
socket. Each incoming datagram is printed as either pretty text or
|
|
52
|
+
one-line JSON.
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
uv run mod_wsgi-telemetry dump \
|
|
56
|
+
--listen unix:/tmp/mod_wsgi-telemetry.sock
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`--format json` is suited to piping into `jq` for filtering or
|
|
60
|
+
into a file for later inspection. `--count N` exits after N
|
|
61
|
+
samples so the command can be invoked from a script. The
|
|
62
|
+
`--socket-mode` and `--socket-group` options match those on
|
|
63
|
+
`serve` if `dump` is being used in a multi-user deployment.
|
|
64
|
+
|
|
65
|
+
## `simulate`: synthetic samples without mod_wsgi
|
|
66
|
+
|
|
67
|
+
`simulate` produces plausibly-shaped samples for a configurable
|
|
68
|
+
number of fake mod_wsgi processes, suitable for exercising the
|
|
69
|
+
ingester and UI without standing up a real Apache + mod_wsgi
|
|
70
|
+
environment. Slow-request records, lifecycle events, response
|
|
71
|
+
class breakdowns, and worker-slot busy fractions are all included
|
|
72
|
+
so every panel of the UI has data to show.
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
uv run mod_wsgi-telemetry serve &
|
|
76
|
+
uv run mod_wsgi-telemetry simulate \
|
|
77
|
+
--target unix:/tmp/mod_wsgi-telemetry.sock \
|
|
78
|
+
--processes 4 \
|
|
79
|
+
--interval 1.0
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Useful when iterating on the UI: changes to `static/index.html`
|
|
83
|
+
or the curses TUI can be exercised against a deterministic data
|
|
84
|
+
source without restarting Apache.
|
|
85
|
+
|
|
86
|
+
## Tests
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
cd telemetry
|
|
90
|
+
uv run pytest
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The current tests cover the wire-format decoder (round-trip and
|
|
94
|
+
rejection cases). Higher-level integration tests covering the
|
|
95
|
+
ingester aggregation and WebSocket push surface are open work.
|
|
96
|
+
|
|
97
|
+
## Wire format
|
|
98
|
+
|
|
99
|
+
The decoder and field-ID table live in
|
|
100
|
+
[src/mod_wsgi/telemetry/wire.py](src/mod_wsgi/telemetry/wire.py).
|
|
101
|
+
This file mirrors `src/server/wsgi_telemetry.h` on the mod_wsgi C
|
|
102
|
+
side; the field IDs must stay in lockstep. Until the C header is
|
|
103
|
+
fully stable, both sides are maintained by hand. A codegen script
|
|
104
|
+
that regenerates the Python table from the C header is planned
|
|
105
|
+
but not yet written. Read the C header for the authoritative
|
|
106
|
+
field-ID enumeration.
|
|
107
|
+
|
|
108
|
+
Time-distribution histograms use an HDR-style layout: 16 octaves
|
|
109
|
+
from 1 ms to 65.5 s (powers of two), each octave linearly split
|
|
110
|
+
into 4 sub-buckets, plus one overflow bucket for values above
|
|
111
|
+
65.5 s, for 65 buckets per histogram. Maximum relative error
|
|
112
|
+
inside any sub-bucket is ≤25%. The encoder in
|
|
113
|
+
`wsgi_record_time_in_buckets` indexes via `frexp` in O(1).
|
|
114
|
+
|
|
115
|
+
Min/max are skipped on idle ticks (the C-side accumulators carry
|
|
116
|
+
a `UINT64_MAX` sentinel until at least one request lands in the
|
|
117
|
+
tick), so absence of the field on the wire is interpreted as "no
|
|
118
|
+
data this tick". Both aggregate cleanly across processes
|
|
119
|
+
(min-of-mins, max-of-maxes) and across time windows; pair them
|
|
120
|
+
with the bucket-derived percentiles to read true worst-case
|
|
121
|
+
alongside the shape of the distribution.
|
|
122
|
+
|
|
123
|
+
## Layout
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
src/mod_wsgi/telemetry/
|
|
127
|
+
cli.py Top-level subcommand dispatcher
|
|
128
|
+
wire.py TLV decoder + field table (mirrors wsgi_telemetry.h)
|
|
129
|
+
ingest.py Async datagram receiver + rolling per-PID window
|
|
130
|
+
server.py aiohttp HTTP + WebSocket + static handler
|
|
131
|
+
tui.py Curses terminal monitor (WebSocket client of server.py)
|
|
132
|
+
dump.py CLI decoded-sample printer
|
|
133
|
+
simulate.py Synthetic sample emitter
|
|
134
|
+
static/
|
|
135
|
+
index.html Single-page UI (vanilla JS canvas charts)
|
|
136
|
+
tests/
|
|
137
|
+
test_wire.py Round-trip + rejection tests for the decoder
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Troubleshooting (development)
|
|
141
|
+
|
|
142
|
+
Operational troubleshooting (UI shows `disconnected`, samples
|
|
143
|
+
have `request_count=0`, etc.) is covered on the user guide page.
|
|
144
|
+
A few problems that mostly arise during development:
|
|
145
|
+
|
|
146
|
+
- **`bind: address already in use`.** A previous run did not clean
|
|
147
|
+
up its socket file, or `dump` and `serve` are running against the
|
|
148
|
+
same path. Stop the other process; the next run unlinks the stale
|
|
149
|
+
file before bind.
|
|
150
|
+
- **UI loads but charts are empty.** The WebSocket is connected
|
|
151
|
+
(no `disconnected` banner) but no samples are arriving. Run
|
|
152
|
+
`simulate` against the same socket to confirm the UI side
|
|
153
|
+
works, then point at the real mod_wsgi-side socket to isolate
|
|
154
|
+
the gap.
|
|
155
|
+
- **`decode_errors` climbing.** Wire-format mismatch. Likely a
|
|
156
|
+
field ID added on the C side without the matching entry in
|
|
157
|
+
`wire.py`. Cross-check `src/server/wsgi_telemetry.h` against
|
|
158
|
+
`wire.py`.
|
|
159
|
+
|
|
160
|
+
## Contributing
|
|
161
|
+
|
|
162
|
+
Bug reports, design discussion, and pull requests live at
|
|
163
|
+
[https://github.com/GrahamDumpleton/mod_wsgi](https://github.com/GrahamDumpleton/mod_wsgi).
|
|
164
|
+
The `mod_wsgi-telemetry` package is developed inside the same
|
|
165
|
+
repository as the `mod_wsgi` Apache module so that wire-format
|
|
166
|
+
changes on both sides can land in the same commit.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "mod_wsgi-telemetry"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
description = "Ingestion service and live UI for mod_wsgi telemetry samples."
|
|
5
|
+
readme = "README-telemetry.rst"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "Graham Dumpleton", email = "Graham.Dumpleton@gmail.com" },
|
|
11
|
+
]
|
|
12
|
+
maintainers = [
|
|
13
|
+
{ name = "Graham Dumpleton", email = "Graham.Dumpleton@gmail.com" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["mod_wsgi", "wsgi", "apache", "telemetry", "monitoring"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Operating System :: MacOS :: MacOS X",
|
|
19
|
+
"Operating System :: POSIX",
|
|
20
|
+
"Operating System :: POSIX :: BSD",
|
|
21
|
+
"Operating System :: POSIX :: Linux",
|
|
22
|
+
"Programming Language :: Python",
|
|
23
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Programming Language :: Python :: 3.14",
|
|
29
|
+
"Topic :: Internet :: WWW/HTTP :: WSGI",
|
|
30
|
+
"Topic :: Internet :: WWW/HTTP :: WSGI :: Server",
|
|
31
|
+
"Topic :: System :: Monitoring",
|
|
32
|
+
]
|
|
33
|
+
dependencies = [
|
|
34
|
+
"aiohttp>=3.9",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://www.modwsgi.org/"
|
|
39
|
+
Documentation = "https://modwsgi.readthedocs.io/en/latest/user-guides/external-telemetry-service.html"
|
|
40
|
+
Source = "https://github.com/GrahamDumpleton/mod_wsgi"
|
|
41
|
+
Issues = "https://github.com/GrahamDumpleton/mod_wsgi/issues"
|
|
42
|
+
|
|
43
|
+
[project.scripts]
|
|
44
|
+
mod_wsgi-telemetry = "mod_wsgi.telemetry.cli:main"
|
|
45
|
+
|
|
46
|
+
[dependency-groups]
|
|
47
|
+
dev = [
|
|
48
|
+
"pytest>=8",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
[build-system]
|
|
52
|
+
requires = ["hatchling"]
|
|
53
|
+
build-backend = "hatchling.build"
|
|
54
|
+
|
|
55
|
+
[tool.hatch.version]
|
|
56
|
+
path = "src/mod_wsgi/telemetry/__init__.py"
|
|
57
|
+
|
|
58
|
+
[tool.hatch.build.targets.sdist]
|
|
59
|
+
exclude = [
|
|
60
|
+
"uv.lock",
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
[tool.hatch.build.targets.wheel]
|
|
64
|
+
packages = ["src/mod_wsgi"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.0dev2"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""Top-level dispatcher for mod_wsgi-telemetry subcommands.
|
|
2
|
+
|
|
3
|
+
Recognises ``serve``, ``top``, ``dump``, ``simulate`` and forwards the
|
|
4
|
+
remaining argv to the subcommand's own ``main(argv)``. Bare invocation
|
|
5
|
+
(no arguments) runs ``serve``.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import sys
|
|
11
|
+
from importlib import import_module
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
_SUBCOMMANDS = {
|
|
15
|
+
"serve": ("mod_wsgi.telemetry.server", "Run the ingestor and web UI (default)."),
|
|
16
|
+
"top": ("mod_wsgi.telemetry.tui", "Curses terminal monitor."),
|
|
17
|
+
"dump": ("mod_wsgi.telemetry.dump", "Bind the listen socket and print decoded samples."),
|
|
18
|
+
"simulate": ("mod_wsgi.telemetry.simulate", "Emit synthetic samples for UI development."),
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _print_usage(stream) -> None:
|
|
23
|
+
print("usage: mod_wsgi-telemetry <command> [options]", file=stream)
|
|
24
|
+
print("", file=stream)
|
|
25
|
+
print("commands:", file=stream)
|
|
26
|
+
for name, (_, desc) in _SUBCOMMANDS.items():
|
|
27
|
+
print(f" {name:9s} {desc}", file=stream)
|
|
28
|
+
print("", file=stream)
|
|
29
|
+
print("Run 'mod_wsgi-telemetry <command> --help' for command-specific options.",
|
|
30
|
+
file=stream)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def main(argv: list[str] | None = None) -> int:
|
|
34
|
+
argv = list(sys.argv[1:] if argv is None else argv)
|
|
35
|
+
|
|
36
|
+
if not argv:
|
|
37
|
+
cmd, rest = "serve", []
|
|
38
|
+
elif argv[0] in ("-h", "--help"):
|
|
39
|
+
_print_usage(sys.stdout)
|
|
40
|
+
return 0
|
|
41
|
+
elif argv[0] in _SUBCOMMANDS:
|
|
42
|
+
cmd, rest = argv[0], argv[1:]
|
|
43
|
+
else:
|
|
44
|
+
print(f"mod_wsgi-telemetry: unknown subcommand or option {argv[0]!r}",
|
|
45
|
+
file=sys.stderr)
|
|
46
|
+
_print_usage(sys.stderr)
|
|
47
|
+
return 2
|
|
48
|
+
|
|
49
|
+
module_name, _ = _SUBCOMMANDS[cmd]
|
|
50
|
+
sys.argv[0] = f"mod_wsgi-telemetry {cmd}"
|
|
51
|
+
return import_module(module_name).main(rest)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
if __name__ == "__main__":
|
|
55
|
+
raise SystemExit(main())
|