watchtower-observability 0.1.2__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.
- watchtower_observability-0.1.2/LICENSE +202 -0
- watchtower_observability-0.1.2/PKG-INFO +45 -0
- watchtower_observability-0.1.2/README.md +136 -0
- watchtower_observability-0.1.2/pyproject.toml +39 -0
- watchtower_observability-0.1.2/setup.cfg +4 -0
- watchtower_observability-0.1.2/tests/test_appsec.py +99 -0
- watchtower_observability-0.1.2/tests/test_buffer.py +17 -0
- watchtower_observability-0.1.2/tests/test_capture.py +110 -0
- watchtower_observability-0.1.2/tests/test_datastores.py +191 -0
- watchtower_observability-0.1.2/tests/test_errors.py +107 -0
- watchtower_observability-0.1.2/tests/test_genai_frameworks.py +67 -0
- watchtower_observability-0.1.2/tests/test_genai_more.py +172 -0
- watchtower_observability-0.1.2/tests/test_iast.py +51 -0
- watchtower_observability-0.1.2/tests/test_init.py +83 -0
- watchtower_observability-0.1.2/tests/test_integrations.py +172 -0
- watchtower_observability-0.1.2/tests/test_origin.py +26 -0
- watchtower_observability-0.1.2/tests/test_probes.py +89 -0
- watchtower_observability-0.1.2/tests/test_profiling.py +86 -0
- watchtower_observability-0.1.2/tests/test_pytest_plugin.py +114 -0
- watchtower_observability-0.1.2/tests/test_remote_sampling.py +60 -0
- watchtower_observability-0.1.2/tests/test_signals.py +121 -0
- watchtower_observability-0.1.2/watchtower/__init__.py +8 -0
- watchtower_observability-0.1.2/watchtower/appsec.py +209 -0
- watchtower_observability-0.1.2/watchtower/buffer.py +71 -0
- watchtower_observability-0.1.2/watchtower/capture.py +163 -0
- watchtower_observability-0.1.2/watchtower/client.py +227 -0
- watchtower_observability-0.1.2/watchtower/errors.py +138 -0
- watchtower_observability-0.1.2/watchtower/iast.py +202 -0
- watchtower_observability-0.1.2/watchtower/integrations/__init__.py +1 -0
- watchtower_observability-0.1.2/watchtower/integrations/aws_lambda.py +24 -0
- watchtower_observability-0.1.2/watchtower/integrations/azure_functions.py +90 -0
- watchtower_observability-0.1.2/watchtower/integrations/celery.py +14 -0
- watchtower_observability-0.1.2/watchtower/integrations/datastores.py +335 -0
- watchtower_observability-0.1.2/watchtower/integrations/django.py +39 -0
- watchtower_observability-0.1.2/watchtower/integrations/fastapi.py +58 -0
- watchtower_observability-0.1.2/watchtower/integrations/flask.py +26 -0
- watchtower_observability-0.1.2/watchtower/integrations/genai.py +216 -0
- watchtower_observability-0.1.2/watchtower/integrations/genai_agents.py +166 -0
- watchtower_observability-0.1.2/watchtower/integrations/genai_frameworks.py +131 -0
- watchtower_observability-0.1.2/watchtower/integrations/genai_more.py +246 -0
- watchtower_observability-0.1.2/watchtower/integrations/http_clients.py +16 -0
- watchtower_observability-0.1.2/watchtower/integrations/kvstores.py +191 -0
- watchtower_observability-0.1.2/watchtower/integrations/sqlalchemy.py +4 -0
- watchtower_observability-0.1.2/watchtower/log_handler.py +22 -0
- watchtower_observability-0.1.2/watchtower/origin.py +35 -0
- watchtower_observability-0.1.2/watchtower/probes.py +404 -0
- watchtower_observability-0.1.2/watchtower/profiling.py +152 -0
- watchtower_observability-0.1.2/watchtower/pytest_plugin.py +274 -0
- watchtower_observability-0.1.2/watchtower/sampling.py +95 -0
- watchtower_observability-0.1.2/watchtower/signals.py +101 -0
- watchtower_observability-0.1.2/watchtower/sqlnorm.py +210 -0
- watchtower_observability-0.1.2/watchtower_observability.egg-info/PKG-INFO +45 -0
- watchtower_observability-0.1.2/watchtower_observability.egg-info/SOURCES.txt +55 -0
- watchtower_observability-0.1.2/watchtower_observability.egg-info/dependency_links.txt +1 -0
- watchtower_observability-0.1.2/watchtower_observability.egg-info/entry_points.txt +2 -0
- watchtower_observability-0.1.2/watchtower_observability.egg-info/requires.txt +50 -0
- watchtower_observability-0.1.2/watchtower_observability.egg-info/top_level.txt +1 -0
|
@@ -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,45 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: watchtower-observability
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Thin Watchtower distribution over the OpenTelemetry Python SDK
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
Project-URL: Source, https://github.com/watchtowerobservability/watchtower-python
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: opentelemetry-sdk>=1.25
|
|
10
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.25
|
|
11
|
+
Requires-Dist: xxhash>=3.3
|
|
12
|
+
Provides-Extra: django
|
|
13
|
+
Requires-Dist: opentelemetry-instrumentation-django>=0.46b0; extra == "django"
|
|
14
|
+
Requires-Dist: django>=4.2; extra == "django"
|
|
15
|
+
Provides-Extra: flask
|
|
16
|
+
Requires-Dist: opentelemetry-instrumentation-flask>=0.46b0; extra == "flask"
|
|
17
|
+
Requires-Dist: flask>=2.3; extra == "flask"
|
|
18
|
+
Provides-Extra: fastapi
|
|
19
|
+
Requires-Dist: opentelemetry-instrumentation-fastapi>=0.46b0; extra == "fastapi"
|
|
20
|
+
Requires-Dist: fastapi>=0.100; extra == "fastapi"
|
|
21
|
+
Provides-Extra: celery
|
|
22
|
+
Requires-Dist: opentelemetry-instrumentation-celery>=0.46b0; extra == "celery"
|
|
23
|
+
Requires-Dist: celery>=5.3; extra == "celery"
|
|
24
|
+
Provides-Extra: sqlalchemy
|
|
25
|
+
Requires-Dist: opentelemetry-instrumentation-sqlalchemy>=0.46b0; extra == "sqlalchemy"
|
|
26
|
+
Requires-Dist: sqlalchemy>=2.0; extra == "sqlalchemy"
|
|
27
|
+
Provides-Extra: requests
|
|
28
|
+
Requires-Dist: opentelemetry-instrumentation-requests>=0.46b0; extra == "requests"
|
|
29
|
+
Requires-Dist: requests>=2.28; extra == "requests"
|
|
30
|
+
Provides-Extra: httpx
|
|
31
|
+
Requires-Dist: opentelemetry-instrumentation-httpx>=0.46b0; extra == "httpx"
|
|
32
|
+
Requires-Dist: httpx>=0.24; extra == "httpx"
|
|
33
|
+
Provides-Extra: runtime
|
|
34
|
+
Requires-Dist: opentelemetry-instrumentation-system-metrics>=0.46b0; extra == "runtime"
|
|
35
|
+
Provides-Extra: aws-lambda
|
|
36
|
+
Provides-Extra: azure-functions
|
|
37
|
+
Provides-Extra: openai
|
|
38
|
+
Provides-Extra: anthropic
|
|
39
|
+
Provides-Extra: langchain
|
|
40
|
+
Requires-Dist: langchain-core>=0.2; extra == "langchain"
|
|
41
|
+
Provides-Extra: test
|
|
42
|
+
Requires-Dist: pytest>=7; extra == "test"
|
|
43
|
+
Requires-Dist: cachetools>=5; extra == "test"
|
|
44
|
+
Requires-Dist: watchtower-observability[celery,django,fastapi,flask,httpx,langchain,requests,runtime,sqlalchemy]; extra == "test"
|
|
45
|
+
Dynamic: license-file
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# watchtower-observability (Python)
|
|
2
|
+
|
|
3
|
+
[](https://github.com/watchtowerobservability/watchtower-python/actions/workflows/ci.yml)
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pip install https://github.com/watchtowerobservability/watchtower-python/releases/download/v0.1.2/watchtower_sdk-0.1.2-py3-none-any.whl
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Thin distribution over the OpenTelemetry Python SDK: `Authorization: Bearer` header, endpoint default
|
|
12
|
+
(`WT_OTLP_ENDPOINT`), disk offline buffer, `wt.*`-safe resource attributes, a redaction hook, and
|
|
13
|
+
`get_prompt`, `score`, `evaluate`, `@observe`. The pytest plugin (`--wt-trace`) traces tests and scores pass/fail.
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
import os, watchtower
|
|
17
|
+
watchtower.init(os.environ["WT_INGEST_KEY"], project=os.environ["WT_PROJECT_ID"], buffer_dir=".wt-buffer")
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Logs and metrics
|
|
21
|
+
|
|
22
|
+
`init` also starts the OpenTelemetry logs and metrics SDKs, exported over OTLP/HTTP to the same
|
|
23
|
+
endpoint with the same key (`/v1/logs`, `/v1/metrics`). Records of the standard `logging` module are
|
|
24
|
+
bridged with the active trace and span ids. Meters come from `opentelemetry.metrics.get_meter(...)`
|
|
25
|
+
(the client sets the global meter provider); counters and histograms use delta temporality unless
|
|
26
|
+
`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` is set. Install `watchtower-observability[runtime]` for
|
|
27
|
+
GC, memory, thread and CPU metrics. With `buffer_dir`, failed log and metric batches are spooled to
|
|
28
|
+
`<buffer_dir>/logs` and `<buffer_dir>/metrics` (500 batches each, oldest dropped) and replayed first.
|
|
29
|
+
The standard `OTEL_BLRP_*` and `OTEL_METRIC_EXPORT_INTERVAL` variables apply.
|
|
30
|
+
|
|
31
|
+
## Quick start
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
import watchtower, logging
|
|
35
|
+
watchtower.init(service_name="api") # key from WT_INGEST_KEY; hooks capture unhandled errors
|
|
36
|
+
logging.getLogger().addHandler(watchtower.WatchtowerHandler())
|
|
37
|
+
try: risky()
|
|
38
|
+
except Exception as e: trace_id = watchtower.capture_exception(e)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Errors are recorded on the current span (or a new `exception` span) and return the trace id.
|
|
42
|
+
`sys.excepthook` and `threading.excepthook` are chained by `init`; for asyncio call `watchtower.install_asyncio(loop)`.
|
|
43
|
+
|
|
44
|
+
## Integrations
|
|
45
|
+
|
|
46
|
+
Install an extra, e.g. `pip install "watchtower-observability[flask]"`, then call `instrument` once after `init`.
|
|
47
|
+
|
|
48
|
+
| Extra | Call | Adds |
|
|
49
|
+
| --- | --- | --- |
|
|
50
|
+
| `django` | `integrations.django.instrument()` + `WatchtowerMiddleware` | OTel server spans, `got_request_exception` and view-exception capture |
|
|
51
|
+
| `flask` | `integrations.flask.instrument(app)` | OTel spans, error capture |
|
|
52
|
+
| `fastapi` | `integrations.fastapi.instrument(app)` | OTel spans (Starlette too), error capture |
|
|
53
|
+
| `celery` | `integrations.celery.instrument()` | task spans, `task_failure` capture |
|
|
54
|
+
| `sqlalchemy` | `integrations.sqlalchemy.instrument(engine)` | query spans |
|
|
55
|
+
| `requests`, `httpx` | `integrations.http_clients.instrument()` | outgoing HTTP spans |
|
|
56
|
+
| `aws-lambda` | `@integrations.aws_lambda.wrap` | invocation span, capture, flush before freeze |
|
|
57
|
+
| `azure-functions` | `@integrations.azure_functions.wrap` | invocation span with cold start and trigger, capture, flush |
|
|
58
|
+
| `openai`, `anthropic` | `integrations.genai.instrument_openai(client)` / `instrument_anthropic(client)` | OTel GenAI spans (model, tokens, finish reasons; no prompt text) |
|
|
59
|
+
| `langchain` | `callbacks=[genai.WatchtowerCallbackHandler()]` | GenAI spans per LLM call |
|
|
60
|
+
| `mistralai`, `ollama` | `genai.instrument_mistral(client)` / `instrument_ollama(client_or_None)` | GenAI spans, streams included (time to first chunk, tokens, tool call names) |
|
|
61
|
+
| `llama-index`, `openai-agents` | `genai.instrument_llamaindex()` / `instrument_openai_agents()` | agent, model and tool spans nested as the framework runs them |
|
|
62
|
+
|
|
63
|
+
### Embedded and in-memory datastores (no extra; pass the object you already have)
|
|
64
|
+
|
|
65
|
+
Spans follow OTel db semconv (`db.system.name`, `db.operation.name`, `db.namespace`, `db.collection.name`).
|
|
66
|
+
SQL spans carry `db.query.hash` (decimal XXH3 of the normalized text, docs/product/instrumentation/sql-normalization.md) and `db.query.summary`,
|
|
67
|
+
never the raw statement; `with_text=True` adds it with every literal replaced by `?`. `observe_*` reports
|
|
68
|
+
`wt.embedded.*` health metrics (file/WAL size, cache hits/misses, map use, compaction debt, ...).
|
|
69
|
+
|
|
70
|
+
| Store | Spans | Metrics |
|
|
71
|
+
| --- | --- | --- |
|
|
72
|
+
| sqlite3 (also pysqlite3, sqlcipher3) | `datastores.instrument_sqlite3(conn)` | `observe_sqlite(path)` |
|
|
73
|
+
| aiosqlite | `instrument_aiosqlite(conn, path)` | `observe_sqlite(path)` |
|
|
74
|
+
| apsw | `instrument_apsw(conn)` | `observe_apsw(conn, apsw)`: page-cache hits/misses, memory |
|
|
75
|
+
| duckdb | `instrument_duckdb(conn, path)` | `observe_duckdb(conn, path)`: blocks, buffer memory, WAL |
|
|
76
|
+
| lmdb | `kvstores.instrument_lmdb(env)`: span per transaction | `observe_lmdb(env)`: map size/use, readers, entries |
|
|
77
|
+
| plyvel (LevelDB) | `instrument_plyvel(db, path)` | `observe_plyvel(db, path)` |
|
|
78
|
+
| rocksdict (RocksDB) | `instrument_rocksdict(db, path)` | `observe_rocksdict(db, path)`: keys, block cache, memtables, pending compaction |
|
|
79
|
+
| tinydb | `instrument_tinydb(db, path)` | `observe_tinydb(db, path)` |
|
|
80
|
+
| diskcache | - | `observe_diskcache(cache)` |
|
|
81
|
+
| cachetools | - | `instrument_cachetools(cache, name)`: hits, misses, evictions in place |
|
|
82
|
+
| functools.lru_cache | - | `observe_lru_cache(fn)` |
|
|
83
|
+
| anything else | `datastores.traced(fn, system, op)` / `Proxy(obj, wraps)` | `datastores.observe(system, ns, fn)` |
|
|
84
|
+
|
|
85
|
+
## App and API Protection
|
|
86
|
+
|
|
87
|
+
An in-app WAF fed by your project's ruleset (key scope `probes:read`). In `monitor` mode it
|
|
88
|
+
records attacks on the current span. In `block` mode, and always for denylisted IPs and users, it
|
|
89
|
+
answers 403 before the app runs.
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from watchtower import appsec
|
|
93
|
+
appsec.start() # WT_API_URL, WT_INGEST_KEY, OTEL_SERVICE_NAME
|
|
94
|
+
app.wsgi_app = appsec.AppsecMiddleware(app.wsgi_app) # Flask / Django
|
|
95
|
+
# ASGI (FastAPI, Starlette): app = appsec.AppsecASGIMiddleware(app)
|
|
96
|
+
# in the login view: appsec.track_login(email, ok)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
See `docs/product/security/app-api-protection.md`.
|
|
100
|
+
|
|
101
|
+
## Configuration
|
|
102
|
+
|
|
103
|
+
| Name | Meaning | Default |
|
|
104
|
+
| --- | --- | --- |
|
|
105
|
+
| `WT_INGEST_KEY` | secret ingest key (`Authorization: Bearer`) | required |
|
|
106
|
+
| `WT_OTLP_ENDPOINT` | OTLP HTTP endpoint | `http://localhost:4318` |
|
|
107
|
+
| `WT_SERVICE` | `service.name` | `app` |
|
|
108
|
+
| `WT_ENVIRONMENT` | `deployment.environment.name` | unset |
|
|
109
|
+
| `WT_RELEASE` | `service.version` | unset |
|
|
110
|
+
| `WATCHTOWER_LOGS` | `on`/`off`: bridge `logging` to OTLP logs (`OTEL_LOGS_EXPORTER=none` also turns it off) | `on` |
|
|
111
|
+
| `WATCHTOWER_METRICS` | `on`/`off`: OTLP metrics (`OTEL_METRICS_EXPORTER=none` also turns it off) | `on` |
|
|
112
|
+
|
|
113
|
+
## Profiling
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
from watchtower import profiling
|
|
117
|
+
profiling.start(service_name="api") # key and endpoint from WT_INGEST_KEY / WT_OTLP_ENDPOINT
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
A pure-Python wall-clock sampler (100 Hz, every thread, no native agent) posts folded stacks to
|
|
121
|
+
the gateway's `/ingest` every 15 s as `<service>.wall`. Inside `with profiling.span():` samples
|
|
122
|
+
carry the current OpenTelemetry span, so a trace links to its exact profile. The label follows the
|
|
123
|
+
function that entered the block, so with asyncio it stays with its task across `await` and other
|
|
124
|
+
tasks stay unlabeled; tasks the block starts are not labeled. For CPU
|
|
125
|
+
time with native frames run py-spy against `/ingest` instead.
|
|
126
|
+
|
|
127
|
+
## Provenance
|
|
128
|
+
|
|
129
|
+
Every release artifact carries a GitHub build attestation. Verify one with
|
|
130
|
+
`gh attestation verify <file> --repo watchtowerobservability/watchtower-python`.
|
|
131
|
+
|
|
132
|
+
A runnable example is in `examples/app.py`.
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
Apache-2.0. Source of truth is the Watchtower monorepo; this repository is a published mirror.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "watchtower-observability"
|
|
3
|
+
version = "0.1.2"
|
|
4
|
+
description = "Thin Watchtower distribution over the OpenTelemetry Python SDK"
|
|
5
|
+
requires-python = ">=3.9"
|
|
6
|
+
license = {text = "Apache-2.0"}
|
|
7
|
+
urls = {Source = "https://github.com/watchtowerobservability/watchtower-python"}
|
|
8
|
+
dependencies = ["opentelemetry-sdk>=1.25", "opentelemetry-exporter-otlp-proto-http>=1.25", "xxhash>=3.3"]
|
|
9
|
+
|
|
10
|
+
[project.optional-dependencies]
|
|
11
|
+
django = ["opentelemetry-instrumentation-django>=0.46b0", "django>=4.2"]
|
|
12
|
+
flask = ["opentelemetry-instrumentation-flask>=0.46b0", "flask>=2.3"]
|
|
13
|
+
fastapi = ["opentelemetry-instrumentation-fastapi>=0.46b0", "fastapi>=0.100"]
|
|
14
|
+
celery = ["opentelemetry-instrumentation-celery>=0.46b0", "celery>=5.3"]
|
|
15
|
+
sqlalchemy = ["opentelemetry-instrumentation-sqlalchemy>=0.46b0", "sqlalchemy>=2.0"]
|
|
16
|
+
requests = ["opentelemetry-instrumentation-requests>=0.46b0", "requests>=2.28"]
|
|
17
|
+
httpx = ["opentelemetry-instrumentation-httpx>=0.46b0", "httpx>=0.24"]
|
|
18
|
+
runtime = ["opentelemetry-instrumentation-system-metrics>=0.46b0"]
|
|
19
|
+
aws-lambda = []
|
|
20
|
+
azure-functions = []
|
|
21
|
+
openai = []
|
|
22
|
+
anthropic = []
|
|
23
|
+
langchain = ["langchain-core>=0.2"]
|
|
24
|
+
test = [
|
|
25
|
+
"pytest>=7", "cachetools>=5", "watchtower-observability[django,flask,fastapi,celery,sqlalchemy,requests,httpx,langchain,runtime]",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.entry-points.pytest11]
|
|
29
|
+
watchtower = "watchtower.pytest_plugin"
|
|
30
|
+
|
|
31
|
+
[build-system]
|
|
32
|
+
requires = ["setuptools>=68"]
|
|
33
|
+
build-backend = "setuptools.build_meta"
|
|
34
|
+
|
|
35
|
+
[tool.setuptools]
|
|
36
|
+
packages = ["watchtower", "watchtower.integrations"]
|
|
37
|
+
|
|
38
|
+
[tool.pytest.ini_options]
|
|
39
|
+
pythonpath = ["."]
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import json
|
|
3
|
+
|
|
4
|
+
from watchtower import appsec
|
|
5
|
+
|
|
6
|
+
RULES = {
|
|
7
|
+
"mode": "monitor",
|
|
8
|
+
"rules": [
|
|
9
|
+
{"id": "sqli-union", "category": "sqli", "fields": ["query", "body", "path"],
|
|
10
|
+
"pattern": r"\bunion\b(?:\s+all)?\s+(?:distinct\s+)?select\b"},
|
|
11
|
+
{"id": "scanner-ua", "category": "scanner", "fields": ["user_agent"], "pattern": "sqlmap|nikto"},
|
|
12
|
+
{"id": "broken", "category": "custom", "fields": ["path"], "pattern": "("},
|
|
13
|
+
],
|
|
14
|
+
"denylist": {"ip": [{"value": "203.0.113.9", "expires_at": None}], "user": [{"value": "mallory", "expires_at": 1}]},
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def teardown_function():
|
|
19
|
+
appsec.set_ruleset(None)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def wsgi(query="", headers=None, peer="198.51.100.7"):
|
|
23
|
+
env = {"PATH_INFO": "/search", "QUERY_STRING": query, "REMOTE_ADDR": peer}
|
|
24
|
+
for k, v in (headers or {}).items():
|
|
25
|
+
env["HTTP_" + k.upper().replace("-", "_")] = v
|
|
26
|
+
return env
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def test_requests_are_decoded_and_matched():
|
|
30
|
+
appsec.set_ruleset(RULES)
|
|
31
|
+
r = appsec.from_wsgi(wsgi("q=1%20UNION+SELECT%20pw", {"X-Forwarded-For": "192.0.2.1, 10.0.0.1"}))
|
|
32
|
+
assert r["query"] == "q=1 UNION SELECT pw"
|
|
33
|
+
assert r["ip"] == "192.0.2.1"
|
|
34
|
+
d = appsec.inspect(r)
|
|
35
|
+
assert (d["action"], d["rule_id"]) == ("monitor", "sqli-union")
|
|
36
|
+
assert appsec.inspect({"path": "/", "user_agent": "sqlmap/1.7"})["rule_id"] == "scanner-ua"
|
|
37
|
+
assert appsec.inspect({"path": "/books", "query": "q=union station"})["action"] == "allow"
|
|
38
|
+
assert not appsec.is_user_blocked("mallory"), "expired entry"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def test_wsgi_blocks_in_block_mode_and_for_denylisted_ips():
|
|
42
|
+
seen = {}
|
|
43
|
+
|
|
44
|
+
def app(environ, start_response):
|
|
45
|
+
start_response("200 OK", [])
|
|
46
|
+
return [b"ok"]
|
|
47
|
+
|
|
48
|
+
def start_response(status, headers):
|
|
49
|
+
seen["status"] = status
|
|
50
|
+
|
|
51
|
+
mw = appsec.AppsecMiddleware(app)
|
|
52
|
+
appsec.set_ruleset(dict(RULES, mode="block"))
|
|
53
|
+
body = mw(wsgi("q=1 union select 2"), start_response)
|
|
54
|
+
assert seen["status"].startswith("403") and json.loads(body[0])["status"] == 403
|
|
55
|
+
appsec.set_ruleset(RULES)
|
|
56
|
+
assert mw(wsgi("q=1 union select 2"), start_response) == [b"ok"]
|
|
57
|
+
mw(wsgi("", peer="203.0.113.9"), start_response)
|
|
58
|
+
assert seen["status"].startswith("403")
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def test_asgi_blocks_before_the_app():
|
|
62
|
+
appsec.set_ruleset(dict(RULES, mode="block"))
|
|
63
|
+
sent, called = [], []
|
|
64
|
+
|
|
65
|
+
async def app(scope, receive, send):
|
|
66
|
+
called.append(True)
|
|
67
|
+
|
|
68
|
+
async def send(m):
|
|
69
|
+
sent.append(m)
|
|
70
|
+
|
|
71
|
+
scope = {"type": "http", "path": "/x", "raw_path": b"/x", "query_string": b"a=1+union+select+2",
|
|
72
|
+
"headers": [(b"user-agent", b"curl")], "client": ("192.0.2.5", 1)}
|
|
73
|
+
asyncio.run(appsec.AppsecASGIMiddleware(app)(scope, None, send))
|
|
74
|
+
assert not called and sent[0]["status"] == 403
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def test_poll_uses_key_and_etag(monkeypatch):
|
|
78
|
+
seen = {}
|
|
79
|
+
|
|
80
|
+
class Resp:
|
|
81
|
+
headers = {"ETag": '"abc"'}
|
|
82
|
+
|
|
83
|
+
def __enter__(self):
|
|
84
|
+
return self
|
|
85
|
+
|
|
86
|
+
def __exit__(self, *a):
|
|
87
|
+
return False
|
|
88
|
+
|
|
89
|
+
def read(self, n):
|
|
90
|
+
return json.dumps(RULES).encode()
|
|
91
|
+
|
|
92
|
+
def fake(req, timeout):
|
|
93
|
+
seen["url"], seen["auth"] = req.full_url, req.get_header("Authorization")
|
|
94
|
+
return Resp()
|
|
95
|
+
|
|
96
|
+
monkeypatch.setattr(appsec.urllib.request, "urlopen", fake)
|
|
97
|
+
body, etag = appsec.fetch("https://edge.test", "wti_x", "api")
|
|
98
|
+
assert seen["url"] == "https://edge.test/v1/appsec/ruleset?service=api"
|
|
99
|
+
assert seen["auth"] == "Bearer wti_x" and etag == '"abc"' and body["mode"] == "monitor"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
from opentelemetry.sdk.trace.export import SpanExportResult
|
|
4
|
+
|
|
5
|
+
from watchtower.buffer import SpoolExporter
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Fail:
|
|
9
|
+
def export(self, spans):
|
|
10
|
+
return SpanExportResult.FAILURE
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_failed_export_is_spooled_and_capped(tmp_path):
|
|
14
|
+
s = SpoolExporter(Fail(), str(tmp_path), "http://127.0.0.1:1/v1/traces", {}, encode=lambda sp: b"x", max_files=2)
|
|
15
|
+
for _ in range(4):
|
|
16
|
+
s.export([])
|
|
17
|
+
assert len(os.listdir(tmp_path)) == 2
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
from watchtower import capture
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_env_is_the_union_of_header_lists():
|
|
7
|
+
env = capture.env_for([
|
|
8
|
+
{"request_headers": ["X-Request-Id", "x-tenant"], "response_headers": ["x-cache"]},
|
|
9
|
+
{"request_headers": ["x-request-id"], "response_headers": []},
|
|
10
|
+
])
|
|
11
|
+
assert env == {capture.REQ: "x-request-id,x-tenant", capture.RESP: "x-cache"}
|
|
12
|
+
assert capture.env_for([]) == {}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_apply_keeps_user_settings_and_survives_failures(monkeypatch):
|
|
16
|
+
class Resp:
|
|
17
|
+
def __enter__(self):
|
|
18
|
+
return self
|
|
19
|
+
|
|
20
|
+
def __exit__(self, *a):
|
|
21
|
+
return False
|
|
22
|
+
|
|
23
|
+
def read(self, _n):
|
|
24
|
+
return json.dumps({"rules": [{"request_headers": ["x-a"], "response_headers": ["x-b"]}]}).encode()
|
|
25
|
+
|
|
26
|
+
seen = []
|
|
27
|
+
monkeypatch.setattr(capture.urllib.request, "urlopen", lambda req, timeout: seen.append(req) or Resp())
|
|
28
|
+
env = {capture.RESP: "x-mine"}
|
|
29
|
+
rules = capture.apply("http://edge", "k", "checkout", environ=env)
|
|
30
|
+
assert rules and env[capture.REQ] == "x-a" and env[capture.RESP] == "x-mine"
|
|
31
|
+
assert seen[0].full_url == "http://edge/v1/capture-rules?service=checkout"
|
|
32
|
+
assert seen[0].get_header("Authorization") == "Bearer k"
|
|
33
|
+
|
|
34
|
+
def boom(req, timeout):
|
|
35
|
+
raise OSError("down")
|
|
36
|
+
|
|
37
|
+
monkeypatch.setattr(capture.urllib.request, "urlopen", boom)
|
|
38
|
+
assert capture.apply("http://edge", "k", "x", environ={}) == []
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class _Span:
|
|
42
|
+
def __init__(self):
|
|
43
|
+
self.attrs = {}
|
|
44
|
+
|
|
45
|
+
def set_attribute(self, k, v):
|
|
46
|
+
self.attrs[k] = v
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def test_bodies_are_capped_redacted_and_route_scoped(monkeypatch):
|
|
50
|
+
monkeypatch.setattr(capture, "RULES", [{"route": "/api/*", "body_bytes": 40}])
|
|
51
|
+
s = _Span()
|
|
52
|
+
body = json.dumps({"user": "a@b.io", "password": "hunter2", "card": "4111 1111 1111 1111"}).encode()
|
|
53
|
+
capture.record(s, "/api/login", "application/json", body, "image/png", b"\x89PNG")
|
|
54
|
+
got = s.attrs["http.request.body"]
|
|
55
|
+
assert len(got.encode()) <= 40 and "hunter2" not in got and "a@b.io" not in got
|
|
56
|
+
assert "http.response.body" not in s.attrs
|
|
57
|
+
other = _Span()
|
|
58
|
+
capture.record(other, "/health", "text/plain", b"x")
|
|
59
|
+
assert other.attrs == {}
|
|
60
|
+
assert capture.redact_text("4111 1111 1111 1112") == "4111 1111 1111 1112"
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def test_graphql_operation_and_document(monkeypatch):
|
|
64
|
+
monkeypatch.setattr(capture, "RULES", [{"graphql_query": True}])
|
|
65
|
+
s = _Span()
|
|
66
|
+
q = '# c\nmutation AddUser { add(email: "x@y.io") { id } }'
|
|
67
|
+
capture.record(s, "/graphql", "application/json", json.dumps({"query": q}).encode())
|
|
68
|
+
assert s.attrs["graphql.operation.type"] == "mutation"
|
|
69
|
+
assert s.attrs["graphql.operation.name"] == "AddUser"
|
|
70
|
+
assert "x@y.io" not in s.attrs["graphql.document"]
|
|
71
|
+
assert capture.graphql_op("{ me { id } }") == ("query", None)
|
|
72
|
+
assert capture.graphql_op("shoes") is None
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def test_asgi_tee_records_what_the_app_read_and_sent(monkeypatch):
|
|
76
|
+
import asyncio
|
|
77
|
+
|
|
78
|
+
from watchtower.integrations import fastapi as wfa
|
|
79
|
+
|
|
80
|
+
monkeypatch.setattr(capture, "RULES", [{"route": "/login", "body_bytes": 200}])
|
|
81
|
+
span = _Span()
|
|
82
|
+
monkeypatch.setattr(wfa.trace, "get_current_span", lambda: span)
|
|
83
|
+
sent = []
|
|
84
|
+
|
|
85
|
+
class Route:
|
|
86
|
+
path = "/login"
|
|
87
|
+
|
|
88
|
+
async def app(scope, receive, send):
|
|
89
|
+
assert (await receive())["body"] == b'{"password": "hunter2"}'
|
|
90
|
+
scope["route"] = Route() # what FastAPI's router does
|
|
91
|
+
await send({"type": "http.response.start", "status": 200, "headers": [(b"content-type", b"application/json")]})
|
|
92
|
+
await send({"type": "http.response.body", "body": b'{"email": "a@b.io"}'})
|
|
93
|
+
|
|
94
|
+
async def receive():
|
|
95
|
+
return {"type": "http.request", "body": b'{"password": "hunter2"}', "more_body": False}
|
|
96
|
+
|
|
97
|
+
async def send(m):
|
|
98
|
+
sent.append(m)
|
|
99
|
+
|
|
100
|
+
scope = {"type": "http", "path": "/login", "headers": [(b"content-type", b"application/json")]}
|
|
101
|
+
asyncio.run(wfa.CaptureMiddleware(app)(scope, receive, send))
|
|
102
|
+
assert len(sent) == 2 and sent[1]["body"] == b'{"email": "a@b.io"}'
|
|
103
|
+
assert span.attrs["http.request.body"] == '{"password": "[REDACTED]"}'
|
|
104
|
+
assert span.attrs["http.response.body"] == '{"email": "[REDACTED]"}'
|
|
105
|
+
|
|
106
|
+
monkeypatch.setattr(capture, "RULES", [])
|
|
107
|
+
quiet = _Span()
|
|
108
|
+
monkeypatch.setattr(wfa.trace, "get_current_span", lambda: quiet)
|
|
109
|
+
asyncio.run(wfa.CaptureMiddleware(app)(dict(scope), receive, send))
|
|
110
|
+
assert quiet.attrs == {}
|