opentelemetry-instrumentation 0.46b0__tar.gz → 0.47b0__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.
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/.gitignore +3 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/PKG-INFO +2 -1
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/pyproject.toml +1 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/src/opentelemetry/instrumentation/_semconv.py +91 -81
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/src/opentelemetry/instrumentation/bootstrap_gen.py +54 -54
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/src/opentelemetry/instrumentation/utils.py +11 -4
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/src/opentelemetry/instrumentation/version.py +1 -1
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/tests/auto_instrumentation/test_load.py +9 -5
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/tests/test_utils.py +54 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/LICENSE +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/README.rst +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/src/opentelemetry/instrumentation/auto_instrumentation/__init__.py +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/src/opentelemetry/instrumentation/auto_instrumentation/_load.py +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/src/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/src/opentelemetry/instrumentation/bootstrap.py +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/src/opentelemetry/instrumentation/dependencies.py +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/src/opentelemetry/instrumentation/distro.py +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/src/opentelemetry/instrumentation/environment_variables.py +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/src/opentelemetry/instrumentation/instrumentor.py +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/src/opentelemetry/instrumentation/propagators.py +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/src/opentelemetry/instrumentation/py.typed +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/src/opentelemetry/instrumentation/sqlcommenter_utils.py +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/tests/__init__.py +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/tests/auto_instrumentation/test_run.py +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/tests/test_bootstrap.py +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/tests/test_dependencies.py +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/tests/test_distro.py +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/tests/test_instrumentor.py +0 -0
- {opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/tests/test_propagators.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: opentelemetry-instrumentation
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.47b0
|
4
4
|
Summary: Instrumentation Tools & Auto Instrumentation for OpenTelemetry Python
|
5
5
|
Project-URL: Homepage, https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/opentelemetry-instrumentation
|
6
6
|
Author-email: OpenTelemetry Authors <cncf-opentelemetry-contributors@lists.cncf.io>
|
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3.8
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.9
|
16
16
|
Classifier: Programming Language :: Python :: 3.10
|
17
17
|
Classifier: Programming Language :: Python :: 3.11
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
18
19
|
Requires-Python: >=3.8
|
19
20
|
Requires-Dist: opentelemetry-api~=1.4
|
20
21
|
Requires-Dist: setuptools>=16.0
|
@@ -17,15 +17,37 @@ import threading
|
|
17
17
|
from enum import Enum
|
18
18
|
|
19
19
|
from opentelemetry.instrumentation.utils import http_status_to_status_code
|
20
|
+
from opentelemetry.semconv.attributes.client_attributes import (
|
21
|
+
CLIENT_ADDRESS,
|
22
|
+
CLIENT_PORT,
|
23
|
+
)
|
24
|
+
from opentelemetry.semconv.attributes.error_attributes import ERROR_TYPE
|
25
|
+
from opentelemetry.semconv.attributes.http_attributes import (
|
26
|
+
HTTP_REQUEST_METHOD,
|
27
|
+
HTTP_REQUEST_METHOD_ORIGINAL,
|
28
|
+
HTTP_RESPONSE_STATUS_CODE,
|
29
|
+
HTTP_ROUTE,
|
30
|
+
)
|
31
|
+
from opentelemetry.semconv.attributes.network_attributes import (
|
32
|
+
NETWORK_PROTOCOL_VERSION,
|
33
|
+
)
|
34
|
+
from opentelemetry.semconv.attributes.server_attributes import (
|
35
|
+
SERVER_ADDRESS,
|
36
|
+
SERVER_PORT,
|
37
|
+
)
|
38
|
+
from opentelemetry.semconv.attributes.url_attributes import (
|
39
|
+
URL_FULL,
|
40
|
+
URL_PATH,
|
41
|
+
URL_QUERY,
|
42
|
+
URL_SCHEME,
|
43
|
+
)
|
44
|
+
from opentelemetry.semconv.attributes.user_agent_attributes import (
|
45
|
+
USER_AGENT_ORIGINAL,
|
46
|
+
)
|
20
47
|
from opentelemetry.semconv.trace import SpanAttributes
|
21
48
|
from opentelemetry.trace.status import Status, StatusCode
|
22
49
|
|
23
|
-
#
|
24
|
-
_SPAN_ATTRIBUTES_ERROR_TYPE = "error.type"
|
25
|
-
_SPAN_ATTRIBUTES_NETWORK_PEER_ADDRESS = "network.peer.address"
|
26
|
-
_SPAN_ATTRIBUTES_NETWORK_PEER_PORT = "network.peer.port"
|
27
|
-
_METRIC_ATTRIBUTES_CLIENT_DURATION_NAME = "http.client.request.duration"
|
28
|
-
_METRIC_ATTRIBUTES_SERVER_DURATION_NAME = "http.server.request.duration"
|
50
|
+
# These lists represent attributes for metrics that are currently supported
|
29
51
|
|
30
52
|
_client_duration_attrs_old = [
|
31
53
|
SpanAttributes.HTTP_STATUS_CODE,
|
@@ -38,14 +60,14 @@ _client_duration_attrs_old = [
|
|
38
60
|
]
|
39
61
|
|
40
62
|
_client_duration_attrs_new = [
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
63
|
+
ERROR_TYPE,
|
64
|
+
HTTP_REQUEST_METHOD,
|
65
|
+
HTTP_RESPONSE_STATUS_CODE,
|
66
|
+
NETWORK_PROTOCOL_VERSION,
|
67
|
+
SERVER_ADDRESS,
|
68
|
+
SERVER_PORT,
|
47
69
|
# TODO: Support opt-in for scheme in new semconv
|
48
|
-
#
|
70
|
+
# URL_SCHEME,
|
49
71
|
]
|
50
72
|
|
51
73
|
_server_duration_attrs_old = [
|
@@ -60,12 +82,12 @@ _server_duration_attrs_old = [
|
|
60
82
|
]
|
61
83
|
|
62
84
|
_server_duration_attrs_new = [
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
85
|
+
ERROR_TYPE,
|
86
|
+
HTTP_REQUEST_METHOD,
|
87
|
+
HTTP_RESPONSE_STATUS_CODE,
|
88
|
+
HTTP_ROUTE,
|
89
|
+
NETWORK_PROTOCOL_VERSION,
|
90
|
+
URL_SCHEME,
|
69
91
|
]
|
70
92
|
|
71
93
|
_server_active_requests_count_attrs_old = [
|
@@ -74,13 +96,12 @@ _server_active_requests_count_attrs_old = [
|
|
74
96
|
SpanAttributes.HTTP_SCHEME,
|
75
97
|
SpanAttributes.HTTP_FLAVOR,
|
76
98
|
SpanAttributes.HTTP_SERVER_NAME,
|
77
|
-
SpanAttributes.NET_HOST_NAME,
|
78
|
-
SpanAttributes.NET_HOST_PORT,
|
79
99
|
]
|
80
100
|
|
81
101
|
_server_active_requests_count_attrs_new = [
|
82
|
-
|
83
|
-
|
102
|
+
HTTP_REQUEST_METHOD,
|
103
|
+
URL_SCHEME,
|
104
|
+
# TODO: Support SERVER_ADDRESS AND SERVER_PORT
|
84
105
|
]
|
85
106
|
|
86
107
|
OTEL_SEMCONV_STABILITY_OPT_IN = "OTEL_SEMCONV_STABILITY_OPT_IN"
|
@@ -202,46 +223,40 @@ def _set_http_method(result, original, normalized, sem_conv_opt_in_mode):
|
|
202
223
|
# See https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md#common-attributes
|
203
224
|
# Method is case sensitive. "http.request.method_original" should not be sanitized or automatically capitalized.
|
204
225
|
if original != normalized and _report_new(sem_conv_opt_in_mode):
|
205
|
-
set_string_attribute(
|
206
|
-
result, SpanAttributes.HTTP_REQUEST_METHOD_ORIGINAL, original
|
207
|
-
)
|
226
|
+
set_string_attribute(result, HTTP_REQUEST_METHOD_ORIGINAL, original)
|
208
227
|
|
209
228
|
if _report_old(sem_conv_opt_in_mode):
|
210
229
|
set_string_attribute(result, SpanAttributes.HTTP_METHOD, normalized)
|
211
230
|
if _report_new(sem_conv_opt_in_mode):
|
212
|
-
set_string_attribute(
|
213
|
-
result, SpanAttributes.HTTP_REQUEST_METHOD, normalized
|
214
|
-
)
|
231
|
+
set_string_attribute(result, HTTP_REQUEST_METHOD, normalized)
|
215
232
|
|
216
233
|
|
217
234
|
def _set_http_status_code(result, code, sem_conv_opt_in_mode):
|
218
235
|
if _report_old(sem_conv_opt_in_mode):
|
219
236
|
set_int_attribute(result, SpanAttributes.HTTP_STATUS_CODE, code)
|
220
237
|
if _report_new(sem_conv_opt_in_mode):
|
221
|
-
set_int_attribute(
|
222
|
-
result, SpanAttributes.HTTP_RESPONSE_STATUS_CODE, code
|
223
|
-
)
|
238
|
+
set_int_attribute(result, HTTP_RESPONSE_STATUS_CODE, code)
|
224
239
|
|
225
240
|
|
226
241
|
def _set_http_url(result, url, sem_conv_opt_in_mode):
|
227
242
|
if _report_old(sem_conv_opt_in_mode):
|
228
243
|
set_string_attribute(result, SpanAttributes.HTTP_URL, url)
|
229
244
|
if _report_new(sem_conv_opt_in_mode):
|
230
|
-
set_string_attribute(result,
|
245
|
+
set_string_attribute(result, URL_FULL, url)
|
231
246
|
|
232
247
|
|
233
248
|
def _set_http_scheme(result, scheme, sem_conv_opt_in_mode):
|
234
249
|
if _report_old(sem_conv_opt_in_mode):
|
235
250
|
set_string_attribute(result, SpanAttributes.HTTP_SCHEME, scheme)
|
236
251
|
if _report_new(sem_conv_opt_in_mode):
|
237
|
-
set_string_attribute(result,
|
252
|
+
set_string_attribute(result, URL_SCHEME, scheme)
|
238
253
|
|
239
254
|
|
240
255
|
def _set_http_host(result, host, sem_conv_opt_in_mode):
|
241
256
|
if _report_old(sem_conv_opt_in_mode):
|
242
257
|
set_string_attribute(result, SpanAttributes.HTTP_HOST, host)
|
243
258
|
if _report_new(sem_conv_opt_in_mode):
|
244
|
-
set_string_attribute(result,
|
259
|
+
set_string_attribute(result, SERVER_ADDRESS, host)
|
245
260
|
|
246
261
|
|
247
262
|
# Client
|
@@ -251,23 +266,21 @@ def _set_http_net_peer_name_client(result, peer_name, sem_conv_opt_in_mode):
|
|
251
266
|
if _report_old(sem_conv_opt_in_mode):
|
252
267
|
set_string_attribute(result, SpanAttributes.NET_PEER_NAME, peer_name)
|
253
268
|
if _report_new(sem_conv_opt_in_mode):
|
254
|
-
set_string_attribute(result,
|
269
|
+
set_string_attribute(result, SERVER_ADDRESS, peer_name)
|
255
270
|
|
256
271
|
|
257
272
|
def _set_http_peer_port_client(result, port, sem_conv_opt_in_mode):
|
258
273
|
if _report_old(sem_conv_opt_in_mode):
|
259
274
|
set_int_attribute(result, SpanAttributes.NET_PEER_PORT, port)
|
260
275
|
if _report_new(sem_conv_opt_in_mode):
|
261
|
-
set_int_attribute(result,
|
276
|
+
set_int_attribute(result, SERVER_PORT, port)
|
262
277
|
|
263
278
|
|
264
279
|
def _set_http_network_protocol_version(result, version, sem_conv_opt_in_mode):
|
265
280
|
if _report_old(sem_conv_opt_in_mode):
|
266
281
|
set_string_attribute(result, SpanAttributes.HTTP_FLAVOR, version)
|
267
282
|
if _report_new(sem_conv_opt_in_mode):
|
268
|
-
set_string_attribute(
|
269
|
-
result, SpanAttributes.NETWORK_PROTOCOL_VERSION, version
|
270
|
-
)
|
283
|
+
set_string_attribute(result, NETWORK_PROTOCOL_VERSION, version)
|
271
284
|
|
272
285
|
|
273
286
|
# Server
|
@@ -277,14 +290,14 @@ def _set_http_net_host(result, host, sem_conv_opt_in_mode):
|
|
277
290
|
if _report_old(sem_conv_opt_in_mode):
|
278
291
|
set_string_attribute(result, SpanAttributes.NET_HOST_NAME, host)
|
279
292
|
if _report_new(sem_conv_opt_in_mode):
|
280
|
-
set_string_attribute(result,
|
293
|
+
set_string_attribute(result, SERVER_ADDRESS, host)
|
281
294
|
|
282
295
|
|
283
296
|
def _set_http_net_host_port(result, port, sem_conv_opt_in_mode):
|
284
297
|
if _report_old(sem_conv_opt_in_mode):
|
285
298
|
set_int_attribute(result, SpanAttributes.NET_HOST_PORT, port)
|
286
299
|
if _report_new(sem_conv_opt_in_mode):
|
287
|
-
set_int_attribute(result,
|
300
|
+
set_int_attribute(result, SERVER_PORT, port)
|
288
301
|
|
289
302
|
|
290
303
|
def _set_http_target(result, target, path, query, sem_conv_opt_in_mode):
|
@@ -292,23 +305,23 @@ def _set_http_target(result, target, path, query, sem_conv_opt_in_mode):
|
|
292
305
|
set_string_attribute(result, SpanAttributes.HTTP_TARGET, target)
|
293
306
|
if _report_new(sem_conv_opt_in_mode):
|
294
307
|
if path:
|
295
|
-
set_string_attribute(result,
|
308
|
+
set_string_attribute(result, URL_PATH, path)
|
296
309
|
if query:
|
297
|
-
set_string_attribute(result,
|
310
|
+
set_string_attribute(result, URL_QUERY, query)
|
298
311
|
|
299
312
|
|
300
313
|
def _set_http_peer_ip(result, ip, sem_conv_opt_in_mode):
|
301
314
|
if _report_old(sem_conv_opt_in_mode):
|
302
315
|
set_string_attribute(result, SpanAttributes.NET_PEER_IP, ip)
|
303
316
|
if _report_new(sem_conv_opt_in_mode):
|
304
|
-
set_string_attribute(result,
|
317
|
+
set_string_attribute(result, CLIENT_ADDRESS, ip)
|
305
318
|
|
306
319
|
|
307
320
|
def _set_http_peer_port_server(result, port, sem_conv_opt_in_mode):
|
308
321
|
if _report_old(sem_conv_opt_in_mode):
|
309
322
|
set_int_attribute(result, SpanAttributes.NET_PEER_PORT, port)
|
310
323
|
if _report_new(sem_conv_opt_in_mode):
|
311
|
-
set_int_attribute(result,
|
324
|
+
set_int_attribute(result, CLIENT_PORT, port)
|
312
325
|
|
313
326
|
|
314
327
|
def _set_http_user_agent(result, user_agent, sem_conv_opt_in_mode):
|
@@ -317,66 +330,63 @@ def _set_http_user_agent(result, user_agent, sem_conv_opt_in_mode):
|
|
317
330
|
result, SpanAttributes.HTTP_USER_AGENT, user_agent
|
318
331
|
)
|
319
332
|
if _report_new(sem_conv_opt_in_mode):
|
320
|
-
set_string_attribute(
|
321
|
-
result, SpanAttributes.USER_AGENT_ORIGINAL, user_agent
|
322
|
-
)
|
333
|
+
set_string_attribute(result, USER_AGENT_ORIGINAL, user_agent)
|
323
334
|
|
324
335
|
|
325
336
|
def _set_http_net_peer_name_server(result, name, sem_conv_opt_in_mode):
|
326
337
|
if _report_old(sem_conv_opt_in_mode):
|
327
338
|
set_string_attribute(result, SpanAttributes.NET_PEER_NAME, name)
|
328
339
|
if _report_new(sem_conv_opt_in_mode):
|
329
|
-
set_string_attribute(result,
|
340
|
+
set_string_attribute(result, CLIENT_ADDRESS, name)
|
330
341
|
|
331
342
|
|
332
343
|
def _set_http_flavor_version(result, version, sem_conv_opt_in_mode):
|
333
344
|
if _report_old(sem_conv_opt_in_mode):
|
334
345
|
set_string_attribute(result, SpanAttributes.HTTP_FLAVOR, version)
|
335
346
|
if _report_new(sem_conv_opt_in_mode):
|
336
|
-
set_string_attribute(
|
337
|
-
result, SpanAttributes.NETWORK_PROTOCOL_VERSION, version
|
338
|
-
)
|
347
|
+
set_string_attribute(result, NETWORK_PROTOCOL_VERSION, version)
|
339
348
|
|
340
349
|
|
341
350
|
def _set_status(
|
342
351
|
span,
|
343
|
-
metrics_attributes,
|
344
|
-
|
345
|
-
|
346
|
-
|
352
|
+
metrics_attributes: dict,
|
353
|
+
status_code: int,
|
354
|
+
status_code_str: str,
|
355
|
+
server_span: bool = True,
|
356
|
+
sem_conv_opt_in_mode: _HTTPStabilityMode = _HTTPStabilityMode.DEFAULT,
|
347
357
|
):
|
348
358
|
if status_code < 0:
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
359
|
+
metrics_attributes[ERROR_TYPE] = status_code_str
|
360
|
+
if span.is_recording():
|
361
|
+
if _report_new(sem_conv_opt_in_mode):
|
362
|
+
span.set_attribute(ERROR_TYPE, status_code_str)
|
363
|
+
span.set_status(
|
364
|
+
Status(
|
365
|
+
StatusCode.ERROR,
|
366
|
+
"Non-integer HTTP status: " + status_code_str,
|
367
|
+
)
|
357
368
|
)
|
358
|
-
)
|
359
369
|
else:
|
360
|
-
status = http_status_to_status_code(
|
370
|
+
status = http_status_to_status_code(
|
371
|
+
status_code, server_span=server_span
|
372
|
+
)
|
361
373
|
|
362
374
|
if _report_old(sem_conv_opt_in_mode):
|
363
|
-
span.
|
375
|
+
if span.is_recording():
|
376
|
+
span.set_attribute(
|
377
|
+
SpanAttributes.HTTP_STATUS_CODE, status_code
|
378
|
+
)
|
364
379
|
metrics_attributes[SpanAttributes.HTTP_STATUS_CODE] = status_code
|
365
380
|
if _report_new(sem_conv_opt_in_mode):
|
366
|
-
span.
|
367
|
-
|
368
|
-
|
369
|
-
metrics_attributes[SpanAttributes.HTTP_RESPONSE_STATUS_CODE] = (
|
370
|
-
status_code
|
371
|
-
)
|
381
|
+
if span.is_recording():
|
382
|
+
span.set_attribute(HTTP_RESPONSE_STATUS_CODE, status_code)
|
383
|
+
metrics_attributes[HTTP_RESPONSE_STATUS_CODE] = status_code
|
372
384
|
if status == StatusCode.ERROR:
|
373
|
-
span.
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
)
|
379
|
-
span.set_status(Status(status))
|
385
|
+
if span.is_recording():
|
386
|
+
span.set_attribute(ERROR_TYPE, status_code_str)
|
387
|
+
metrics_attributes[ERROR_TYPE] = status_code_str
|
388
|
+
if span.is_recording():
|
389
|
+
span.set_status(Status(status))
|
380
390
|
|
381
391
|
|
382
392
|
# Get schema version based off of opt-in mode
|
@@ -18,180 +18,180 @@
|
|
18
18
|
libraries = [
|
19
19
|
{
|
20
20
|
"library": "aio_pika >= 7.2.0, < 10.0.0",
|
21
|
-
"instrumentation": "opentelemetry-instrumentation-aio-pika==0.
|
21
|
+
"instrumentation": "opentelemetry-instrumentation-aio-pika==0.47b0",
|
22
22
|
},
|
23
23
|
{
|
24
24
|
"library": "aiohttp ~= 3.0",
|
25
|
-
"instrumentation": "opentelemetry-instrumentation-aiohttp-client==0.
|
25
|
+
"instrumentation": "opentelemetry-instrumentation-aiohttp-client==0.47b0",
|
26
26
|
},
|
27
27
|
{
|
28
28
|
"library": "aiohttp ~= 3.0",
|
29
|
-
"instrumentation": "opentelemetry-instrumentation-aiohttp-server==0.
|
29
|
+
"instrumentation": "opentelemetry-instrumentation-aiohttp-server==0.47b0",
|
30
30
|
},
|
31
31
|
{
|
32
32
|
"library": "aiopg >= 0.13.0, < 2.0.0",
|
33
|
-
"instrumentation": "opentelemetry-instrumentation-aiopg==0.
|
33
|
+
"instrumentation": "opentelemetry-instrumentation-aiopg==0.47b0",
|
34
34
|
},
|
35
35
|
{
|
36
36
|
"library": "asgiref ~= 3.0",
|
37
|
-
"instrumentation": "opentelemetry-instrumentation-asgi==0.
|
37
|
+
"instrumentation": "opentelemetry-instrumentation-asgi==0.47b0",
|
38
38
|
},
|
39
39
|
{
|
40
40
|
"library": "asyncpg >= 0.12.0",
|
41
|
-
"instrumentation": "opentelemetry-instrumentation-asyncpg==0.
|
41
|
+
"instrumentation": "opentelemetry-instrumentation-asyncpg==0.47b0",
|
42
42
|
},
|
43
43
|
{
|
44
44
|
"library": "boto~=2.0",
|
45
|
-
"instrumentation": "opentelemetry-instrumentation-boto==0.
|
45
|
+
"instrumentation": "opentelemetry-instrumentation-boto==0.47b0",
|
46
46
|
},
|
47
47
|
{
|
48
48
|
"library": "boto3 ~= 1.0",
|
49
|
-
"instrumentation": "opentelemetry-instrumentation-boto3sqs==0.
|
49
|
+
"instrumentation": "opentelemetry-instrumentation-boto3sqs==0.47b0",
|
50
50
|
},
|
51
51
|
{
|
52
52
|
"library": "botocore ~= 1.0",
|
53
|
-
"instrumentation": "opentelemetry-instrumentation-botocore==0.
|
53
|
+
"instrumentation": "opentelemetry-instrumentation-botocore==0.47b0",
|
54
54
|
},
|
55
55
|
{
|
56
56
|
"library": "cassandra-driver ~= 3.25",
|
57
|
-
"instrumentation": "opentelemetry-instrumentation-cassandra==0.
|
57
|
+
"instrumentation": "opentelemetry-instrumentation-cassandra==0.47b0",
|
58
58
|
},
|
59
59
|
{
|
60
60
|
"library": "scylla-driver ~= 3.25",
|
61
|
-
"instrumentation": "opentelemetry-instrumentation-cassandra==0.
|
61
|
+
"instrumentation": "opentelemetry-instrumentation-cassandra==0.47b0",
|
62
62
|
},
|
63
63
|
{
|
64
64
|
"library": "celery >= 4.0, < 6.0",
|
65
|
-
"instrumentation": "opentelemetry-instrumentation-celery==0.
|
65
|
+
"instrumentation": "opentelemetry-instrumentation-celery==0.47b0",
|
66
66
|
},
|
67
67
|
{
|
68
|
-
"library": "confluent-kafka >= 1.8.2, <= 2.
|
69
|
-
"instrumentation": "opentelemetry-instrumentation-confluent-kafka==0.
|
68
|
+
"library": "confluent-kafka >= 1.8.2, <= 2.4.0",
|
69
|
+
"instrumentation": "opentelemetry-instrumentation-confluent-kafka==0.47b0",
|
70
70
|
},
|
71
71
|
{
|
72
72
|
"library": "django >= 1.10",
|
73
|
-
"instrumentation": "opentelemetry-instrumentation-django==0.
|
73
|
+
"instrumentation": "opentelemetry-instrumentation-django==0.47b0",
|
74
74
|
},
|
75
75
|
{
|
76
76
|
"library": "elasticsearch >= 6.0",
|
77
|
-
"instrumentation": "opentelemetry-instrumentation-elasticsearch==0.
|
77
|
+
"instrumentation": "opentelemetry-instrumentation-elasticsearch==0.47b0",
|
78
78
|
},
|
79
79
|
{
|
80
80
|
"library": "falcon >= 1.4.1, < 3.1.2",
|
81
|
-
"instrumentation": "opentelemetry-instrumentation-falcon==0.
|
81
|
+
"instrumentation": "opentelemetry-instrumentation-falcon==0.47b0",
|
82
82
|
},
|
83
83
|
{
|
84
84
|
"library": "fastapi ~= 0.58",
|
85
|
-
"instrumentation": "opentelemetry-instrumentation-fastapi==0.
|
85
|
+
"instrumentation": "opentelemetry-instrumentation-fastapi==0.47b0",
|
86
|
+
},
|
87
|
+
{
|
88
|
+
"library": "fastapi-slim ~= 0.111.0",
|
89
|
+
"instrumentation": "opentelemetry-instrumentation-fastapi==0.47b0",
|
86
90
|
},
|
87
91
|
{
|
88
92
|
"library": "flask >= 1.0",
|
89
|
-
"instrumentation": "opentelemetry-instrumentation-flask==0.
|
93
|
+
"instrumentation": "opentelemetry-instrumentation-flask==0.47b0",
|
90
94
|
},
|
91
95
|
{
|
92
96
|
"library": "grpcio ~= 1.27",
|
93
|
-
"instrumentation": "opentelemetry-instrumentation-grpc==0.
|
97
|
+
"instrumentation": "opentelemetry-instrumentation-grpc==0.47b0",
|
94
98
|
},
|
95
99
|
{
|
96
100
|
"library": "httpx >= 0.18.0",
|
97
|
-
"instrumentation": "opentelemetry-instrumentation-httpx==0.
|
101
|
+
"instrumentation": "opentelemetry-instrumentation-httpx==0.47b0",
|
98
102
|
},
|
99
103
|
{
|
100
104
|
"library": "jinja2 >= 2.7, < 4.0",
|
101
|
-
"instrumentation": "opentelemetry-instrumentation-jinja2==0.
|
105
|
+
"instrumentation": "opentelemetry-instrumentation-jinja2==0.47b0",
|
102
106
|
},
|
103
107
|
{
|
104
108
|
"library": "kafka-python >= 2.0",
|
105
|
-
"instrumentation": "opentelemetry-instrumentation-kafka-python==0.
|
109
|
+
"instrumentation": "opentelemetry-instrumentation-kafka-python==0.47b0",
|
106
110
|
},
|
107
111
|
{
|
108
112
|
"library": "mysql-connector-python ~= 8.0",
|
109
|
-
"instrumentation": "opentelemetry-instrumentation-mysql==0.
|
113
|
+
"instrumentation": "opentelemetry-instrumentation-mysql==0.47b0",
|
110
114
|
},
|
111
115
|
{
|
112
116
|
"library": "mysqlclient < 3",
|
113
|
-
"instrumentation": "opentelemetry-instrumentation-mysqlclient==0.
|
117
|
+
"instrumentation": "opentelemetry-instrumentation-mysqlclient==0.47b0",
|
114
118
|
},
|
115
119
|
{
|
116
120
|
"library": "pika >= 0.12.0",
|
117
|
-
"instrumentation": "opentelemetry-instrumentation-pika==0.
|
121
|
+
"instrumentation": "opentelemetry-instrumentation-pika==0.47b0",
|
118
122
|
},
|
119
123
|
{
|
120
124
|
"library": "psycopg >= 3.1.0",
|
121
|
-
"instrumentation": "opentelemetry-instrumentation-psycopg==0.
|
125
|
+
"instrumentation": "opentelemetry-instrumentation-psycopg==0.47b0",
|
122
126
|
},
|
123
127
|
{
|
124
128
|
"library": "psycopg2 >= 2.7.3.1",
|
125
|
-
"instrumentation": "opentelemetry-instrumentation-psycopg2==0.
|
129
|
+
"instrumentation": "opentelemetry-instrumentation-psycopg2==0.47b0",
|
126
130
|
},
|
127
131
|
{
|
128
132
|
"library": "pymemcache >= 1.3.5, < 5",
|
129
|
-
"instrumentation": "opentelemetry-instrumentation-pymemcache==0.
|
133
|
+
"instrumentation": "opentelemetry-instrumentation-pymemcache==0.47b0",
|
130
134
|
},
|
131
135
|
{
|
132
136
|
"library": "pymongo >= 3.1, < 5.0",
|
133
|
-
"instrumentation": "opentelemetry-instrumentation-pymongo==0.
|
137
|
+
"instrumentation": "opentelemetry-instrumentation-pymongo==0.47b0",
|
134
138
|
},
|
135
139
|
{
|
136
140
|
"library": "PyMySQL < 2",
|
137
|
-
"instrumentation": "opentelemetry-instrumentation-pymysql==0.
|
141
|
+
"instrumentation": "opentelemetry-instrumentation-pymysql==0.47b0",
|
138
142
|
},
|
139
143
|
{
|
140
144
|
"library": "pyramid >= 1.7",
|
141
|
-
"instrumentation": "opentelemetry-instrumentation-pyramid==0.
|
145
|
+
"instrumentation": "opentelemetry-instrumentation-pyramid==0.47b0",
|
142
146
|
},
|
143
147
|
{
|
144
148
|
"library": "redis >= 2.6",
|
145
|
-
"instrumentation": "opentelemetry-instrumentation-redis==0.
|
149
|
+
"instrumentation": "opentelemetry-instrumentation-redis==0.47b0",
|
146
150
|
},
|
147
151
|
{
|
148
152
|
"library": "remoulade >= 0.50",
|
149
|
-
"instrumentation": "opentelemetry-instrumentation-remoulade==0.
|
153
|
+
"instrumentation": "opentelemetry-instrumentation-remoulade==0.47b0",
|
150
154
|
},
|
151
155
|
{
|
152
156
|
"library": "requests ~= 2.0",
|
153
|
-
"instrumentation": "opentelemetry-instrumentation-requests==0.
|
154
|
-
},
|
155
|
-
{
|
156
|
-
"library": "scikit-learn ~= 0.24.0",
|
157
|
-
"instrumentation": "opentelemetry-instrumentation-sklearn==0.46b0",
|
157
|
+
"instrumentation": "opentelemetry-instrumentation-requests==0.47b0",
|
158
158
|
},
|
159
159
|
{
|
160
160
|
"library": "sqlalchemy",
|
161
|
-
"instrumentation": "opentelemetry-instrumentation-sqlalchemy==0.
|
161
|
+
"instrumentation": "opentelemetry-instrumentation-sqlalchemy==0.47b0",
|
162
162
|
},
|
163
163
|
{
|
164
164
|
"library": "starlette ~= 0.13.0",
|
165
|
-
"instrumentation": "opentelemetry-instrumentation-starlette==0.
|
165
|
+
"instrumentation": "opentelemetry-instrumentation-starlette==0.47b0",
|
166
166
|
},
|
167
167
|
{
|
168
168
|
"library": "psutil >= 5",
|
169
|
-
"instrumentation": "opentelemetry-instrumentation-system-metrics==0.
|
169
|
+
"instrumentation": "opentelemetry-instrumentation-system-metrics==0.47b0",
|
170
170
|
},
|
171
171
|
{
|
172
172
|
"library": "tornado >= 5.1.1",
|
173
|
-
"instrumentation": "opentelemetry-instrumentation-tornado==0.
|
173
|
+
"instrumentation": "opentelemetry-instrumentation-tornado==0.47b0",
|
174
174
|
},
|
175
175
|
{
|
176
176
|
"library": "tortoise-orm >= 0.17.0",
|
177
|
-
"instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.
|
177
|
+
"instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.47b0",
|
178
178
|
},
|
179
179
|
{
|
180
180
|
"library": "pydantic >= 1.10.2",
|
181
|
-
"instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.
|
181
|
+
"instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.47b0",
|
182
182
|
},
|
183
183
|
{
|
184
184
|
"library": "urllib3 >= 1.0.0, < 3.0.0",
|
185
|
-
"instrumentation": "opentelemetry-instrumentation-urllib3==0.
|
185
|
+
"instrumentation": "opentelemetry-instrumentation-urllib3==0.47b0",
|
186
186
|
},
|
187
187
|
]
|
188
188
|
default_instrumentations = [
|
189
|
-
"opentelemetry-instrumentation-asyncio==0.
|
190
|
-
"opentelemetry-instrumentation-aws-lambda==0.
|
191
|
-
"opentelemetry-instrumentation-dbapi==0.
|
192
|
-
"opentelemetry-instrumentation-logging==0.
|
193
|
-
"opentelemetry-instrumentation-sqlite3==0.
|
194
|
-
"opentelemetry-instrumentation-threading==0.
|
195
|
-
"opentelemetry-instrumentation-urllib==0.
|
196
|
-
"opentelemetry-instrumentation-wsgi==0.
|
189
|
+
"opentelemetry-instrumentation-asyncio==0.47b0",
|
190
|
+
"opentelemetry-instrumentation-aws-lambda==0.47b0",
|
191
|
+
"opentelemetry-instrumentation-dbapi==0.47b0",
|
192
|
+
"opentelemetry-instrumentation-logging==0.47b0",
|
193
|
+
"opentelemetry-instrumentation-sqlite3==0.47b0",
|
194
|
+
"opentelemetry-instrumentation-threading==0.47b0",
|
195
|
+
"opentelemetry-instrumentation-urllib==0.47b0",
|
196
|
+
"opentelemetry-instrumentation-wsgi==0.47b0",
|
197
197
|
]
|
@@ -37,6 +37,10 @@ from opentelemetry.trace.propagation.tracecontext import (
|
|
37
37
|
|
38
38
|
propagator = TraceContextTextMapPropagator()
|
39
39
|
|
40
|
+
_SUPPRESS_INSTRUMENTATION_KEY_PLAIN = (
|
41
|
+
"suppress_instrumentation" # Set for backward compatibility
|
42
|
+
)
|
43
|
+
|
40
44
|
|
41
45
|
def extract_attributes_from_object(
|
42
46
|
obj: any, attributes: Sequence[str], existing: Dict[str, str] = None
|
@@ -161,9 +165,10 @@ def _python_path_without_directory(python_path, directory, path_separator):
|
|
161
165
|
|
162
166
|
|
163
167
|
def is_instrumentation_enabled() -> bool:
|
164
|
-
|
165
|
-
|
166
|
-
|
168
|
+
return not (
|
169
|
+
context.get_value(_SUPPRESS_INSTRUMENTATION_KEY)
|
170
|
+
or context.get_value(_SUPPRESS_INSTRUMENTATION_KEY_PLAIN)
|
171
|
+
)
|
167
172
|
|
168
173
|
|
169
174
|
def is_http_instrumentation_enabled() -> bool:
|
@@ -188,7 +193,9 @@ def _suppress_instrumentation(*keys: str) -> Iterable[None]:
|
|
188
193
|
@contextmanager
|
189
194
|
def suppress_instrumentation() -> Iterable[None]:
|
190
195
|
"""Suppress instrumentation within the context."""
|
191
|
-
with _suppress_instrumentation(
|
196
|
+
with _suppress_instrumentation(
|
197
|
+
_SUPPRESS_INSTRUMENTATION_KEY, _SUPPRESS_INSTRUMENTATION_KEY_PLAIN
|
198
|
+
):
|
192
199
|
yield
|
193
200
|
|
194
201
|
|
@@ -32,7 +32,9 @@ class TestLoad(TestCase):
|
|
32
32
|
@patch(
|
33
33
|
"opentelemetry.instrumentation.auto_instrumentation._load.iter_entry_points"
|
34
34
|
)
|
35
|
-
def test_load_configurators(
|
35
|
+
def test_load_configurators(
|
36
|
+
self, iter_mock
|
37
|
+
): # pylint: disable=no-self-use
|
36
38
|
# Add multiple entry points but only specify the 2nd in the environment variable.
|
37
39
|
ep_mock1 = Mock()
|
38
40
|
ep_mock1.name = "custom_configurator1"
|
@@ -62,9 +64,8 @@ class TestLoad(TestCase):
|
|
62
64
|
"opentelemetry.instrumentation.auto_instrumentation._load.iter_entry_points"
|
63
65
|
)
|
64
66
|
def test_load_configurators_no_ep(
|
65
|
-
self,
|
66
|
-
|
67
|
-
):
|
67
|
+
self, iter_mock
|
68
|
+
): # pylint: disable=no-self-use
|
68
69
|
iter_mock.return_value = ()
|
69
70
|
# Confirm method does not crash if not entry points exist.
|
70
71
|
_load._load_configurators()
|
@@ -214,6 +215,7 @@ class TestLoad(TestCase):
|
|
214
215
|
)
|
215
216
|
def test_load_instrumentors(self, iter_mock, dep_mock):
|
216
217
|
# Mock opentelemetry_pre_instrument entry points
|
218
|
+
# pylint: disable=too-many-locals
|
217
219
|
pre_ep_mock1 = Mock()
|
218
220
|
pre_ep_mock1.name = "pre1"
|
219
221
|
pre_mock1 = Mock()
|
@@ -285,7 +287,9 @@ class TestLoad(TestCase):
|
|
285
287
|
@patch(
|
286
288
|
"opentelemetry.instrumentation.auto_instrumentation._load.iter_entry_points"
|
287
289
|
)
|
288
|
-
def test_load_instrumentors_dep_conflict(
|
290
|
+
def test_load_instrumentors_dep_conflict(
|
291
|
+
self, iter_mock, dep_mock
|
292
|
+
): # pylint: disable=no-self-use
|
289
293
|
ep_mock1 = Mock()
|
290
294
|
ep_mock1.name = "instr1"
|
291
295
|
|
{opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/tests/test_utils.py
RENAMED
@@ -15,10 +15,20 @@
|
|
15
15
|
import unittest
|
16
16
|
from http import HTTPStatus
|
17
17
|
|
18
|
+
from opentelemetry.context import (
|
19
|
+
_SUPPRESS_HTTP_INSTRUMENTATION_KEY,
|
20
|
+
_SUPPRESS_INSTRUMENTATION_KEY,
|
21
|
+
get_current,
|
22
|
+
get_value,
|
23
|
+
)
|
18
24
|
from opentelemetry.instrumentation.sqlcommenter_utils import _add_sql_comment
|
19
25
|
from opentelemetry.instrumentation.utils import (
|
20
26
|
_python_path_without_directory,
|
21
27
|
http_status_to_status_code,
|
28
|
+
is_http_instrumentation_enabled,
|
29
|
+
is_instrumentation_enabled,
|
30
|
+
suppress_http_instrumentation,
|
31
|
+
suppress_instrumentation,
|
22
32
|
)
|
23
33
|
from opentelemetry.trace import StatusCode
|
24
34
|
|
@@ -186,3 +196,47 @@ class TestUtils(unittest.TestCase):
|
|
186
196
|
)
|
187
197
|
|
188
198
|
self.assertEqual(commented_sql_without_semicolon, "Select 1")
|
199
|
+
|
200
|
+
def test_is_instrumentation_enabled_by_default(self):
|
201
|
+
self.assertTrue(is_instrumentation_enabled())
|
202
|
+
self.assertTrue(is_http_instrumentation_enabled())
|
203
|
+
|
204
|
+
def test_suppress_instrumentation(self):
|
205
|
+
with suppress_instrumentation():
|
206
|
+
self.assertFalse(is_instrumentation_enabled())
|
207
|
+
self.assertFalse(is_http_instrumentation_enabled())
|
208
|
+
|
209
|
+
self.assertTrue(is_instrumentation_enabled())
|
210
|
+
self.assertTrue(is_http_instrumentation_enabled())
|
211
|
+
|
212
|
+
def test_suppress_http_instrumentation(self):
|
213
|
+
with suppress_http_instrumentation():
|
214
|
+
self.assertFalse(is_http_instrumentation_enabled())
|
215
|
+
self.assertTrue(is_instrumentation_enabled())
|
216
|
+
|
217
|
+
self.assertTrue(is_instrumentation_enabled())
|
218
|
+
self.assertTrue(is_http_instrumentation_enabled())
|
219
|
+
|
220
|
+
def test_suppress_instrumentation_key(self):
|
221
|
+
self.assertIsNone(get_value(_SUPPRESS_INSTRUMENTATION_KEY))
|
222
|
+
self.assertIsNone(get_value("suppress_instrumentation"))
|
223
|
+
|
224
|
+
with suppress_instrumentation():
|
225
|
+
ctx = get_current()
|
226
|
+
self.assertIn(_SUPPRESS_INSTRUMENTATION_KEY, ctx)
|
227
|
+
self.assertIn("suppress_instrumentation", ctx)
|
228
|
+
self.assertTrue(get_value(_SUPPRESS_INSTRUMENTATION_KEY))
|
229
|
+
self.assertTrue(get_value("suppress_instrumentation"))
|
230
|
+
|
231
|
+
self.assertIsNone(get_value(_SUPPRESS_INSTRUMENTATION_KEY))
|
232
|
+
self.assertIsNone(get_value("suppress_instrumentation"))
|
233
|
+
|
234
|
+
def test_suppress_http_instrumentation_key(self):
|
235
|
+
self.assertIsNone(get_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY))
|
236
|
+
|
237
|
+
with suppress_http_instrumentation():
|
238
|
+
ctx = get_current()
|
239
|
+
self.assertIn(_SUPPRESS_HTTP_INSTRUMENTATION_KEY, ctx)
|
240
|
+
self.assertTrue(get_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY))
|
241
|
+
|
242
|
+
self.assertIsNone(get_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY))
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/tests/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{opentelemetry_instrumentation-0.46b0 → opentelemetry_instrumentation-0.47b0}/tests/test_distro.py
RENAMED
File without changes
|
File without changes
|
File without changes
|