opentelemetry-instrumentation 0.50b0__tar.gz → 0.51b0__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.50b0 → opentelemetry_instrumentation-0.51b0}/PKG-INFO +7 -4
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/pyproject.toml +3 -1
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/src/opentelemetry/instrumentation/_semconv.py +69 -44
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/src/opentelemetry/instrumentation/bootstrap_gen.py +66 -54
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/src/opentelemetry/instrumentation/dependencies.py +8 -7
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/src/opentelemetry/instrumentation/utils.py +12 -10
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/src/opentelemetry/instrumentation/version.py +1 -1
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/tests/test_dependencies.py +16 -0
- opentelemetry_instrumentation-0.51b0/tests/test_semconv.py +258 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/.gitignore +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/LICENSE +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/README.rst +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/src/opentelemetry/instrumentation/auto_instrumentation/__init__.py +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/src/opentelemetry/instrumentation/auto_instrumentation/_load.py +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/src/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/src/opentelemetry/instrumentation/bootstrap.py +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/src/opentelemetry/instrumentation/distro.py +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/src/opentelemetry/instrumentation/environment_variables.py +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/src/opentelemetry/instrumentation/instrumentor.py +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/src/opentelemetry/instrumentation/propagators.py +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/src/opentelemetry/instrumentation/py.typed +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/src/opentelemetry/instrumentation/sqlcommenter_utils.py +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/tests/__init__.py +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/tests/auto_instrumentation/test_load.py +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/tests/auto_instrumentation/test_run.py +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/tests/test_bootstrap.py +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/tests/test_distro.py +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/tests/test_instrumentor.py +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/tests/test_propagators.py +0 -0
- {opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/tests/test_utils.py +0 -0
@@ -1,10 +1,12 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: opentelemetry-instrumentation
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.51b0
|
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
|
+
Project-URL: Repository, https://github.com/open-telemetry/opentelemetry-python-contrib
|
6
7
|
Author-email: OpenTelemetry Authors <cncf-opentelemetry-contributors@lists.cncf.io>
|
7
|
-
License: Apache-2.0
|
8
|
+
License-Expression: Apache-2.0
|
9
|
+
License-File: LICENSE
|
8
10
|
Classifier: Development Status :: 4 - Beta
|
9
11
|
Classifier: Intended Audience :: Developers
|
10
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
@@ -15,9 +17,10 @@ Classifier: Programming Language :: Python :: 3.9
|
|
15
17
|
Classifier: Programming Language :: Python :: 3.10
|
16
18
|
Classifier: Programming Language :: Python :: 3.11
|
17
19
|
Classifier: Programming Language :: Python :: 3.12
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
18
21
|
Requires-Python: >=3.8
|
19
22
|
Requires-Dist: opentelemetry-api~=1.4
|
20
|
-
Requires-Dist: opentelemetry-semantic-conventions==0.
|
23
|
+
Requires-Dist: opentelemetry-semantic-conventions==0.51b0
|
21
24
|
Requires-Dist: packaging>=18.0
|
22
25
|
Requires-Dist: wrapt<2.0.0,>=1.0.0
|
23
26
|
Description-Content-Type: text/x-rst
|
{opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/pyproject.toml
RENAMED
@@ -23,10 +23,11 @@ classifiers = [
|
|
23
23
|
"Programming Language :: Python :: 3.10",
|
24
24
|
"Programming Language :: Python :: 3.11",
|
25
25
|
"Programming Language :: Python :: 3.12",
|
26
|
+
"Programming Language :: Python :: 3.13",
|
26
27
|
]
|
27
28
|
dependencies = [
|
28
29
|
"opentelemetry-api ~= 1.4",
|
29
|
-
"opentelemetry-semantic-conventions == 0.
|
30
|
+
"opentelemetry-semantic-conventions == 0.51b0",
|
30
31
|
"wrapt >= 1.0.0, < 2.0.0",
|
31
32
|
"packaging >= 18.0",
|
32
33
|
]
|
@@ -40,6 +41,7 @@ instrumentation = "opentelemetry.instrumentation.environment_variables"
|
|
40
41
|
|
41
42
|
[project.urls]
|
42
43
|
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/opentelemetry-instrumentation"
|
44
|
+
Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib"
|
43
45
|
|
44
46
|
[tool.hatch.version]
|
45
47
|
path = "src/opentelemetry/instrumentation/version.py"
|
@@ -109,23 +109,23 @@ OTEL_SEMCONV_STABILITY_OPT_IN = "OTEL_SEMCONV_STABILITY_OPT_IN"
|
|
109
109
|
|
110
110
|
class _OpenTelemetryStabilitySignalType:
|
111
111
|
HTTP = "http"
|
112
|
+
DATABASE = "database"
|
112
113
|
|
113
114
|
|
114
|
-
class
|
115
|
-
|
115
|
+
class _StabilityMode(Enum):
|
116
|
+
DEFAULT = "default"
|
116
117
|
HTTP = "http"
|
117
|
-
# http/dup - emit both the old and the stable HTTP and networking conventions
|
118
118
|
HTTP_DUP = "http/dup"
|
119
|
-
|
120
|
-
|
119
|
+
DATABASE = "database"
|
120
|
+
DATABASE_DUP = "database/dup"
|
121
121
|
|
122
122
|
|
123
|
-
def _report_new(mode):
|
124
|
-
return mode
|
123
|
+
def _report_new(mode: _StabilityMode):
|
124
|
+
return mode != _StabilityMode.DEFAULT
|
125
125
|
|
126
126
|
|
127
|
-
def _report_old(mode):
|
128
|
-
return mode
|
127
|
+
def _report_old(mode: _StabilityMode):
|
128
|
+
return mode not in (_StabilityMode.HTTP, _StabilityMode.DATABASE)
|
129
129
|
|
130
130
|
|
131
131
|
class _OpenTelemetrySemanticConventionStability:
|
@@ -135,35 +135,61 @@ class _OpenTelemetrySemanticConventionStability:
|
|
135
135
|
|
136
136
|
@classmethod
|
137
137
|
def _initialize(cls):
|
138
|
-
with
|
139
|
-
if
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
138
|
+
with cls._lock:
|
139
|
+
if cls._initialized:
|
140
|
+
return
|
141
|
+
|
142
|
+
# Users can pass in comma delimited string for opt-in options
|
143
|
+
# Only values for http and database stability are supported for now
|
144
|
+
opt_in = os.environ.get(OTEL_SEMCONV_STABILITY_OPT_IN)
|
145
|
+
|
146
|
+
if not opt_in:
|
147
|
+
# early return in case of default
|
148
|
+
cls._OTEL_SEMCONV_STABILITY_SIGNAL_MAPPING = {
|
149
|
+
_OpenTelemetryStabilitySignalType.HTTP: _StabilityMode.DEFAULT,
|
150
|
+
_OpenTelemetryStabilitySignalType.DATABASE: _StabilityMode.DEFAULT,
|
151
|
+
}
|
152
|
+
cls._initialized = True
|
153
|
+
return
|
154
|
+
|
155
|
+
opt_in_list = [s.strip() for s in opt_in.split(",")]
|
156
|
+
|
157
|
+
cls._OTEL_SEMCONV_STABILITY_SIGNAL_MAPPING[
|
158
|
+
_OpenTelemetryStabilitySignalType.HTTP
|
159
|
+
] = cls._filter_mode(
|
160
|
+
opt_in_list, _StabilityMode.HTTP, _StabilityMode.HTTP_DUP
|
161
|
+
)
|
162
|
+
|
163
|
+
cls._OTEL_SEMCONV_STABILITY_SIGNAL_MAPPING[
|
164
|
+
_OpenTelemetryStabilitySignalType.DATABASE
|
165
|
+
] = cls._filter_mode(
|
166
|
+
opt_in_list,
|
167
|
+
_StabilityMode.DATABASE,
|
168
|
+
_StabilityMode.DATABASE_DUP,
|
169
|
+
)
|
170
|
+
|
171
|
+
cls._initialized = True
|
172
|
+
|
173
|
+
@staticmethod
|
174
|
+
def _filter_mode(opt_in_list, stable_mode, dup_mode):
|
175
|
+
# Process semconv stability opt-in
|
176
|
+
# http/dup,database/dup has higher precedence over http,database
|
177
|
+
if dup_mode.value in opt_in_list:
|
178
|
+
return dup_mode
|
179
|
+
|
180
|
+
return (
|
181
|
+
stable_mode
|
182
|
+
if stable_mode.value in opt_in_list
|
183
|
+
else _StabilityMode.DEFAULT
|
184
|
+
)
|
158
185
|
|
159
186
|
@classmethod
|
160
|
-
# Get OpenTelemetry opt-in mode based off of signal type (http, messaging, etc.)
|
161
187
|
def _get_opentelemetry_stability_opt_in_mode(
|
162
|
-
cls,
|
163
|
-
|
164
|
-
|
165
|
-
return
|
166
|
-
signal_type,
|
188
|
+
cls, signal_type: _OpenTelemetryStabilitySignalType
|
189
|
+
) -> _StabilityMode:
|
190
|
+
# Get OpenTelemetry opt-in mode based off of signal type (http, messaging, etc.)
|
191
|
+
return cls._OTEL_SEMCONV_STABILITY_SIGNAL_MAPPING.get(
|
192
|
+
signal_type, _StabilityMode.DEFAULT
|
167
193
|
)
|
168
194
|
|
169
195
|
|
@@ -171,14 +197,12 @@ def _filter_semconv_duration_attrs(
|
|
171
197
|
attrs,
|
172
198
|
old_attrs,
|
173
199
|
new_attrs,
|
174
|
-
sem_conv_opt_in_mode=
|
200
|
+
sem_conv_opt_in_mode=_StabilityMode.DEFAULT,
|
175
201
|
):
|
176
202
|
filtered_attrs = {}
|
177
203
|
# duration is two different metrics depending on sem_conv_opt_in_mode, so no DUP attributes
|
178
204
|
allowed_attributes = (
|
179
|
-
new_attrs
|
180
|
-
if sem_conv_opt_in_mode == _HTTPStabilityMode.HTTP
|
181
|
-
else old_attrs
|
205
|
+
new_attrs if sem_conv_opt_in_mode == _StabilityMode.HTTP else old_attrs
|
182
206
|
)
|
183
207
|
for key, val in attrs.items():
|
184
208
|
if key in allowed_attributes:
|
@@ -190,7 +214,7 @@ def _filter_semconv_active_request_count_attr(
|
|
190
214
|
attrs,
|
191
215
|
old_attrs,
|
192
216
|
new_attrs,
|
193
|
-
sem_conv_opt_in_mode=
|
217
|
+
sem_conv_opt_in_mode=_StabilityMode.DEFAULT,
|
194
218
|
):
|
195
219
|
filtered_attrs = {}
|
196
220
|
if _report_old(sem_conv_opt_in_mode):
|
@@ -367,10 +391,11 @@ def _set_status(
|
|
367
391
|
status_code: int,
|
368
392
|
status_code_str: str,
|
369
393
|
server_span: bool = True,
|
370
|
-
sem_conv_opt_in_mode:
|
394
|
+
sem_conv_opt_in_mode: _StabilityMode = _StabilityMode.DEFAULT,
|
371
395
|
):
|
372
396
|
if status_code < 0:
|
373
|
-
|
397
|
+
if _report_new(sem_conv_opt_in_mode):
|
398
|
+
metrics_attributes[ERROR_TYPE] = status_code_str
|
374
399
|
if span.is_recording():
|
375
400
|
if _report_new(sem_conv_opt_in_mode):
|
376
401
|
span.set_attribute(ERROR_TYPE, status_code_str)
|
@@ -404,7 +429,7 @@ def _set_status(
|
|
404
429
|
|
405
430
|
|
406
431
|
# Get schema version based off of opt-in mode
|
407
|
-
def _get_schema_url(mode:
|
408
|
-
if mode is
|
432
|
+
def _get_schema_url(mode: _StabilityMode) -> str:
|
433
|
+
if mode is _StabilityMode.DEFAULT:
|
409
434
|
return "https://opentelemetry.io/schemas/1.11.0"
|
410
435
|
return SpanAttributes.SCHEMA_URL
|
@@ -18,191 +18,203 @@
|
|
18
18
|
libraries = [
|
19
19
|
{
|
20
20
|
"library": "openai >= 1.26.0",
|
21
|
-
"instrumentation": "opentelemetry-instrumentation-openai-v2==2.
|
21
|
+
"instrumentation": "opentelemetry-instrumentation-openai-v2==2.2b0.dev",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"library": "google-cloud-aiplatform >= 1.64",
|
25
|
+
"instrumentation": "opentelemetry-instrumentation-vertexai==2.1b0.dev",
|
22
26
|
},
|
23
27
|
{
|
24
28
|
"library": "aio_pika >= 7.2.0, < 10.0.0",
|
25
|
-
"instrumentation": "opentelemetry-instrumentation-aio-pika==0.
|
29
|
+
"instrumentation": "opentelemetry-instrumentation-aio-pika==0.51b0",
|
26
30
|
},
|
27
31
|
{
|
28
32
|
"library": "aiohttp ~= 3.0",
|
29
|
-
"instrumentation": "opentelemetry-instrumentation-aiohttp-client==0.
|
33
|
+
"instrumentation": "opentelemetry-instrumentation-aiohttp-client==0.51b0",
|
30
34
|
},
|
31
35
|
{
|
32
36
|
"library": "aiohttp ~= 3.0",
|
33
|
-
"instrumentation": "opentelemetry-instrumentation-aiohttp-server==0.
|
37
|
+
"instrumentation": "opentelemetry-instrumentation-aiohttp-server==0.51b0",
|
34
38
|
},
|
35
39
|
{
|
36
40
|
"library": "aiokafka >= 0.8, < 1.0",
|
37
|
-
"instrumentation": "opentelemetry-instrumentation-aiokafka==0.
|
41
|
+
"instrumentation": "opentelemetry-instrumentation-aiokafka==0.51b0",
|
38
42
|
},
|
39
43
|
{
|
40
44
|
"library": "aiopg >= 0.13.0, < 2.0.0",
|
41
|
-
"instrumentation": "opentelemetry-instrumentation-aiopg==0.
|
45
|
+
"instrumentation": "opentelemetry-instrumentation-aiopg==0.51b0",
|
42
46
|
},
|
43
47
|
{
|
44
48
|
"library": "asgiref ~= 3.0",
|
45
|
-
"instrumentation": "opentelemetry-instrumentation-asgi==0.
|
49
|
+
"instrumentation": "opentelemetry-instrumentation-asgi==0.51b0",
|
46
50
|
},
|
47
51
|
{
|
48
52
|
"library": "asyncpg >= 0.12.0",
|
49
|
-
"instrumentation": "opentelemetry-instrumentation-asyncpg==0.
|
53
|
+
"instrumentation": "opentelemetry-instrumentation-asyncpg==0.51b0",
|
50
54
|
},
|
51
55
|
{
|
52
56
|
"library": "boto~=2.0",
|
53
|
-
"instrumentation": "opentelemetry-instrumentation-boto==0.
|
57
|
+
"instrumentation": "opentelemetry-instrumentation-boto==0.51b0",
|
54
58
|
},
|
55
59
|
{
|
56
60
|
"library": "boto3 ~= 1.0",
|
57
|
-
"instrumentation": "opentelemetry-instrumentation-boto3sqs==0.
|
61
|
+
"instrumentation": "opentelemetry-instrumentation-boto3sqs==0.51b0",
|
58
62
|
},
|
59
63
|
{
|
60
64
|
"library": "botocore ~= 1.0",
|
61
|
-
"instrumentation": "opentelemetry-instrumentation-botocore==0.
|
65
|
+
"instrumentation": "opentelemetry-instrumentation-botocore==0.51b0",
|
62
66
|
},
|
63
67
|
{
|
64
68
|
"library": "cassandra-driver ~= 3.25",
|
65
|
-
"instrumentation": "opentelemetry-instrumentation-cassandra==0.
|
69
|
+
"instrumentation": "opentelemetry-instrumentation-cassandra==0.51b0",
|
66
70
|
},
|
67
71
|
{
|
68
72
|
"library": "scylla-driver ~= 3.25",
|
69
|
-
"instrumentation": "opentelemetry-instrumentation-cassandra==0.
|
73
|
+
"instrumentation": "opentelemetry-instrumentation-cassandra==0.51b0",
|
70
74
|
},
|
71
75
|
{
|
72
76
|
"library": "celery >= 4.0, < 6.0",
|
73
|
-
"instrumentation": "opentelemetry-instrumentation-celery==0.
|
77
|
+
"instrumentation": "opentelemetry-instrumentation-celery==0.51b0",
|
74
78
|
},
|
75
79
|
{
|
76
80
|
"library": "click >= 8.1.3, < 9.0.0",
|
77
|
-
"instrumentation": "opentelemetry-instrumentation-click==0.
|
81
|
+
"instrumentation": "opentelemetry-instrumentation-click==0.51b0",
|
78
82
|
},
|
79
83
|
{
|
80
|
-
"library": "confluent-kafka >= 1.8.2, <= 2.
|
81
|
-
"instrumentation": "opentelemetry-instrumentation-confluent-kafka==0.
|
84
|
+
"library": "confluent-kafka >= 1.8.2, <= 2.7.0",
|
85
|
+
"instrumentation": "opentelemetry-instrumentation-confluent-kafka==0.51b0",
|
82
86
|
},
|
83
87
|
{
|
84
88
|
"library": "django >= 1.10",
|
85
|
-
"instrumentation": "opentelemetry-instrumentation-django==0.
|
89
|
+
"instrumentation": "opentelemetry-instrumentation-django==0.51b0",
|
86
90
|
},
|
87
91
|
{
|
88
92
|
"library": "elasticsearch >= 6.0",
|
89
|
-
"instrumentation": "opentelemetry-instrumentation-elasticsearch==0.
|
93
|
+
"instrumentation": "opentelemetry-instrumentation-elasticsearch==0.51b0",
|
90
94
|
},
|
91
95
|
{
|
92
|
-
"library": "falcon >= 1.4.1, <
|
93
|
-
"instrumentation": "opentelemetry-instrumentation-falcon==0.
|
96
|
+
"library": "falcon >= 1.4.1, < 5.0.0",
|
97
|
+
"instrumentation": "opentelemetry-instrumentation-falcon==0.51b0",
|
94
98
|
},
|
95
99
|
{
|
96
100
|
"library": "fastapi ~= 0.58",
|
97
|
-
"instrumentation": "opentelemetry-instrumentation-fastapi==0.
|
101
|
+
"instrumentation": "opentelemetry-instrumentation-fastapi==0.51b0",
|
98
102
|
},
|
99
103
|
{
|
100
104
|
"library": "flask >= 1.0",
|
101
|
-
"instrumentation": "opentelemetry-instrumentation-flask==0.
|
105
|
+
"instrumentation": "opentelemetry-instrumentation-flask==0.51b0",
|
102
106
|
},
|
103
107
|
{
|
104
108
|
"library": "grpcio >= 1.42.0",
|
105
|
-
"instrumentation": "opentelemetry-instrumentation-grpc==0.
|
109
|
+
"instrumentation": "opentelemetry-instrumentation-grpc==0.51b0",
|
106
110
|
},
|
107
111
|
{
|
108
112
|
"library": "httpx >= 0.18.0",
|
109
|
-
"instrumentation": "opentelemetry-instrumentation-httpx==0.
|
113
|
+
"instrumentation": "opentelemetry-instrumentation-httpx==0.51b0",
|
110
114
|
},
|
111
115
|
{
|
112
116
|
"library": "jinja2 >= 2.7, < 4.0",
|
113
|
-
"instrumentation": "opentelemetry-instrumentation-jinja2==0.
|
117
|
+
"instrumentation": "opentelemetry-instrumentation-jinja2==0.51b0",
|
114
118
|
},
|
115
119
|
{
|
116
120
|
"library": "kafka-python >= 2.0, < 3.0",
|
117
|
-
"instrumentation": "opentelemetry-instrumentation-kafka-python==0.
|
121
|
+
"instrumentation": "opentelemetry-instrumentation-kafka-python==0.51b0",
|
118
122
|
},
|
119
123
|
{
|
120
124
|
"library": "kafka-python-ng >= 2.0, < 3.0",
|
121
|
-
"instrumentation": "opentelemetry-instrumentation-kafka-python==0.
|
125
|
+
"instrumentation": "opentelemetry-instrumentation-kafka-python==0.51b0",
|
122
126
|
},
|
123
127
|
{
|
124
128
|
"library": "mysql-connector-python >= 8.0, < 10.0",
|
125
|
-
"instrumentation": "opentelemetry-instrumentation-mysql==0.
|
129
|
+
"instrumentation": "opentelemetry-instrumentation-mysql==0.51b0",
|
126
130
|
},
|
127
131
|
{
|
128
132
|
"library": "mysqlclient < 3",
|
129
|
-
"instrumentation": "opentelemetry-instrumentation-mysqlclient==0.
|
133
|
+
"instrumentation": "opentelemetry-instrumentation-mysqlclient==0.51b0",
|
130
134
|
},
|
131
135
|
{
|
132
136
|
"library": "pika >= 0.12.0",
|
133
|
-
"instrumentation": "opentelemetry-instrumentation-pika==0.
|
137
|
+
"instrumentation": "opentelemetry-instrumentation-pika==0.51b0",
|
134
138
|
},
|
135
139
|
{
|
136
140
|
"library": "psycopg >= 3.1.0",
|
137
|
-
"instrumentation": "opentelemetry-instrumentation-psycopg==0.
|
141
|
+
"instrumentation": "opentelemetry-instrumentation-psycopg==0.51b0",
|
138
142
|
},
|
139
143
|
{
|
140
144
|
"library": "psycopg2 >= 2.7.3.1",
|
141
|
-
"instrumentation": "opentelemetry-instrumentation-psycopg2==0.
|
145
|
+
"instrumentation": "opentelemetry-instrumentation-psycopg2==0.51b0",
|
146
|
+
},
|
147
|
+
{
|
148
|
+
"library": "psycopg2-binary >= 2.7.3.1",
|
149
|
+
"instrumentation": "opentelemetry-instrumentation-psycopg2==0.51b0",
|
142
150
|
},
|
143
151
|
{
|
144
152
|
"library": "pymemcache >= 1.3.5, < 5",
|
145
|
-
"instrumentation": "opentelemetry-instrumentation-pymemcache==0.
|
153
|
+
"instrumentation": "opentelemetry-instrumentation-pymemcache==0.51b0",
|
146
154
|
},
|
147
155
|
{
|
148
156
|
"library": "pymongo >= 3.1, < 5.0",
|
149
|
-
"instrumentation": "opentelemetry-instrumentation-pymongo==0.
|
157
|
+
"instrumentation": "opentelemetry-instrumentation-pymongo==0.51b0",
|
158
|
+
},
|
159
|
+
{
|
160
|
+
"library": "pymssql >= 2.1.5, < 3",
|
161
|
+
"instrumentation": "opentelemetry-instrumentation-pymssql==0.51b0",
|
150
162
|
},
|
151
163
|
{
|
152
164
|
"library": "PyMySQL < 2",
|
153
|
-
"instrumentation": "opentelemetry-instrumentation-pymysql==0.
|
165
|
+
"instrumentation": "opentelemetry-instrumentation-pymysql==0.51b0",
|
154
166
|
},
|
155
167
|
{
|
156
168
|
"library": "pyramid >= 1.7",
|
157
|
-
"instrumentation": "opentelemetry-instrumentation-pyramid==0.
|
169
|
+
"instrumentation": "opentelemetry-instrumentation-pyramid==0.51b0",
|
158
170
|
},
|
159
171
|
{
|
160
172
|
"library": "redis >= 2.6",
|
161
|
-
"instrumentation": "opentelemetry-instrumentation-redis==0.
|
173
|
+
"instrumentation": "opentelemetry-instrumentation-redis==0.51b0",
|
162
174
|
},
|
163
175
|
{
|
164
176
|
"library": "remoulade >= 0.50",
|
165
|
-
"instrumentation": "opentelemetry-instrumentation-remoulade==0.
|
177
|
+
"instrumentation": "opentelemetry-instrumentation-remoulade==0.51b0",
|
166
178
|
},
|
167
179
|
{
|
168
180
|
"library": "requests ~= 2.0",
|
169
|
-
"instrumentation": "opentelemetry-instrumentation-requests==0.
|
181
|
+
"instrumentation": "opentelemetry-instrumentation-requests==0.51b0",
|
170
182
|
},
|
171
183
|
{
|
172
184
|
"library": "sqlalchemy >= 1.0.0, < 2.1.0",
|
173
|
-
"instrumentation": "opentelemetry-instrumentation-sqlalchemy==0.
|
185
|
+
"instrumentation": "opentelemetry-instrumentation-sqlalchemy==0.51b0",
|
174
186
|
},
|
175
187
|
{
|
176
188
|
"library": "starlette ~= 0.13.0",
|
177
|
-
"instrumentation": "opentelemetry-instrumentation-starlette==0.
|
189
|
+
"instrumentation": "opentelemetry-instrumentation-starlette==0.51b0",
|
178
190
|
},
|
179
191
|
{
|
180
192
|
"library": "psutil >= 5",
|
181
|
-
"instrumentation": "opentelemetry-instrumentation-system-metrics==0.
|
193
|
+
"instrumentation": "opentelemetry-instrumentation-system-metrics==0.51b0",
|
182
194
|
},
|
183
195
|
{
|
184
196
|
"library": "tornado >= 5.1.1",
|
185
|
-
"instrumentation": "opentelemetry-instrumentation-tornado==0.
|
197
|
+
"instrumentation": "opentelemetry-instrumentation-tornado==0.51b0",
|
186
198
|
},
|
187
199
|
{
|
188
200
|
"library": "tortoise-orm >= 0.17.0",
|
189
|
-
"instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.
|
201
|
+
"instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.51b0",
|
190
202
|
},
|
191
203
|
{
|
192
204
|
"library": "pydantic >= 1.10.2",
|
193
|
-
"instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.
|
205
|
+
"instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.51b0",
|
194
206
|
},
|
195
207
|
{
|
196
208
|
"library": "urllib3 >= 1.0.0, < 3.0.0",
|
197
|
-
"instrumentation": "opentelemetry-instrumentation-urllib3==0.
|
209
|
+
"instrumentation": "opentelemetry-instrumentation-urllib3==0.51b0",
|
198
210
|
},
|
199
211
|
]
|
200
212
|
default_instrumentations = [
|
201
|
-
"opentelemetry-instrumentation-asyncio==0.
|
202
|
-
"opentelemetry-instrumentation-dbapi==0.
|
203
|
-
"opentelemetry-instrumentation-logging==0.
|
204
|
-
"opentelemetry-instrumentation-sqlite3==0.
|
205
|
-
"opentelemetry-instrumentation-threading==0.
|
206
|
-
"opentelemetry-instrumentation-urllib==0.
|
207
|
-
"opentelemetry-instrumentation-wsgi==0.
|
213
|
+
"opentelemetry-instrumentation-asyncio==0.51b0",
|
214
|
+
"opentelemetry-instrumentation-dbapi==0.51b0",
|
215
|
+
"opentelemetry-instrumentation-logging==0.51b0",
|
216
|
+
"opentelemetry-instrumentation-sqlite3==0.51b0",
|
217
|
+
"opentelemetry-instrumentation-threading==0.51b0",
|
218
|
+
"opentelemetry-instrumentation-urllib==0.51b0",
|
219
|
+
"opentelemetry-instrumentation-wsgi==0.51b0",
|
208
220
|
]
|
@@ -47,13 +47,14 @@ def get_dist_dependency_conflicts(
|
|
47
47
|
extra = "extra"
|
48
48
|
instruments = "instruments"
|
49
49
|
instruments_marker = {extra: instruments}
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
50
|
+
if dist.requires:
|
51
|
+
for dep in dist.requires:
|
52
|
+
if extra not in dep or instruments not in dep:
|
53
|
+
continue
|
54
|
+
|
55
|
+
req = Requirement(dep)
|
56
|
+
if req.marker.evaluate(instruments_marker):
|
57
|
+
instrumentation_deps.append(req)
|
57
58
|
|
58
59
|
return get_dependency_conflicts(instrumentation_deps)
|
59
60
|
|
@@ -12,11 +12,13 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
from __future__ import annotations
|
16
|
+
|
15
17
|
import urllib.parse
|
16
18
|
from contextlib import contextmanager
|
17
19
|
from importlib import import_module
|
18
20
|
from re import escape, sub
|
19
|
-
from typing import Dict,
|
21
|
+
from typing import Any, Dict, Generator, Sequence
|
20
22
|
|
21
23
|
from wrapt import ObjectProxy
|
22
24
|
|
@@ -44,9 +46,9 @@ _SUPPRESS_INSTRUMENTATION_KEY_PLAIN = (
|
|
44
46
|
|
45
47
|
|
46
48
|
def extract_attributes_from_object(
|
47
|
-
obj:
|
49
|
+
obj: Any, attributes: Sequence[str], existing: Dict[str, str] | None = None
|
48
50
|
) -> Dict[str, str]:
|
49
|
-
extracted = {}
|
51
|
+
extracted: dict[str, str] = {}
|
50
52
|
if existing:
|
51
53
|
extracted.update(existing)
|
52
54
|
for attr in attributes:
|
@@ -81,7 +83,7 @@ def http_status_to_status_code(
|
|
81
83
|
return StatusCode.ERROR
|
82
84
|
|
83
85
|
|
84
|
-
def unwrap(obj:
|
86
|
+
def unwrap(obj: object, attr: str):
|
85
87
|
"""Given a function that was wrapped by wrapt.wrap_function_wrapper, unwrap it
|
86
88
|
|
87
89
|
The object containing the function to unwrap may be passed as dotted module path string.
|
@@ -152,7 +154,7 @@ def _start_internal_or_server_span(
|
|
152
154
|
return span, token
|
153
155
|
|
154
156
|
|
155
|
-
def _url_quote(s) -> str: # pylint: disable=invalid-name
|
157
|
+
def _url_quote(s: Any) -> str: # pylint: disable=invalid-name
|
156
158
|
if not isinstance(s, (str, bytes)):
|
157
159
|
return s
|
158
160
|
quoted = urllib.parse.quote(s)
|
@@ -163,13 +165,13 @@ def _url_quote(s) -> str: # pylint: disable=invalid-name
|
|
163
165
|
return quoted.replace("%", "%%")
|
164
166
|
|
165
167
|
|
166
|
-
def _get_opentelemetry_values() -> dict:
|
168
|
+
def _get_opentelemetry_values() -> dict[str, Any]:
|
167
169
|
"""
|
168
170
|
Return the OpenTelemetry Trace and Span IDs if Span ID is set in the
|
169
171
|
OpenTelemetry execution context.
|
170
172
|
"""
|
171
173
|
# Insert the W3C TraceContext generated
|
172
|
-
_headers = {}
|
174
|
+
_headers: dict[str, Any] = {}
|
173
175
|
propagator.inject(_headers)
|
174
176
|
return _headers
|
175
177
|
|
@@ -196,7 +198,7 @@ def is_http_instrumentation_enabled() -> bool:
|
|
196
198
|
|
197
199
|
|
198
200
|
@contextmanager
|
199
|
-
def _suppress_instrumentation(*keys: str) ->
|
201
|
+
def _suppress_instrumentation(*keys: str) -> Generator[None]:
|
200
202
|
"""Suppress instrumentation within the context."""
|
201
203
|
ctx = context.get_current()
|
202
204
|
for key in keys:
|
@@ -209,7 +211,7 @@ def _suppress_instrumentation(*keys: str) -> Iterable[None]:
|
|
209
211
|
|
210
212
|
|
211
213
|
@contextmanager
|
212
|
-
def suppress_instrumentation() ->
|
214
|
+
def suppress_instrumentation() -> Generator[None]:
|
213
215
|
"""Suppress instrumentation within the context."""
|
214
216
|
with _suppress_instrumentation(
|
215
217
|
_SUPPRESS_INSTRUMENTATION_KEY, _SUPPRESS_INSTRUMENTATION_KEY_PLAIN
|
@@ -218,7 +220,7 @@ def suppress_instrumentation() -> Iterable[None]:
|
|
218
220
|
|
219
221
|
|
220
222
|
@contextmanager
|
221
|
-
def suppress_http_instrumentation() ->
|
223
|
+
def suppress_http_instrumentation() -> Generator[None]:
|
222
224
|
"""Suppress instrumentation within the context."""
|
223
225
|
with _suppress_instrumentation(_SUPPRESS_HTTP_INSTRUMENTATION_KEY):
|
224
226
|
yield
|
@@ -86,3 +86,19 @@ class TestDependencyConflicts(TestBase):
|
|
86
86
|
str(conflict),
|
87
87
|
'DependencyConflict: requested: "test-pkg~=1.0; extra == "instruments"" but found: "None"',
|
88
88
|
)
|
89
|
+
|
90
|
+
def test_get_dist_dependency_conflicts_requires_none(self):
|
91
|
+
class MockDistribution(Distribution):
|
92
|
+
def locate_file(self, path):
|
93
|
+
pass
|
94
|
+
|
95
|
+
def read_text(self, filename):
|
96
|
+
pass
|
97
|
+
|
98
|
+
@property
|
99
|
+
def requires(self):
|
100
|
+
return None
|
101
|
+
|
102
|
+
dist = MockDistribution()
|
103
|
+
conflict = get_dist_dependency_conflicts(dist)
|
104
|
+
self.assertTrue(conflict is None)
|
@@ -0,0 +1,258 @@
|
|
1
|
+
# Copyright The OpenTelemetry Authors
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
import os
|
16
|
+
from unittest import TestCase
|
17
|
+
from unittest.mock import Mock, patch
|
18
|
+
|
19
|
+
from opentelemetry.instrumentation._semconv import (
|
20
|
+
OTEL_SEMCONV_STABILITY_OPT_IN,
|
21
|
+
_OpenTelemetrySemanticConventionStability,
|
22
|
+
_OpenTelemetryStabilitySignalType,
|
23
|
+
_set_status,
|
24
|
+
_StabilityMode,
|
25
|
+
)
|
26
|
+
from opentelemetry.trace.status import StatusCode
|
27
|
+
|
28
|
+
|
29
|
+
def stability_mode(mode):
|
30
|
+
def decorator(test_case):
|
31
|
+
@patch.dict(os.environ, {OTEL_SEMCONV_STABILITY_OPT_IN: mode})
|
32
|
+
def wrapper(*args, **kwargs):
|
33
|
+
_OpenTelemetrySemanticConventionStability._initialized = False
|
34
|
+
_OpenTelemetrySemanticConventionStability._initialize()
|
35
|
+
return test_case(*args, **kwargs)
|
36
|
+
|
37
|
+
return wrapper
|
38
|
+
|
39
|
+
return decorator
|
40
|
+
|
41
|
+
|
42
|
+
class TestOpenTelemetrySemConvStability(TestCase):
|
43
|
+
@stability_mode("")
|
44
|
+
def test_default_mode(self):
|
45
|
+
self.assertEqual(
|
46
|
+
_OpenTelemetrySemanticConventionStability._get_opentelemetry_stability_opt_in_mode(
|
47
|
+
_OpenTelemetryStabilitySignalType.HTTP
|
48
|
+
),
|
49
|
+
_StabilityMode.DEFAULT,
|
50
|
+
)
|
51
|
+
self.assertEqual(
|
52
|
+
_OpenTelemetrySemanticConventionStability._get_opentelemetry_stability_opt_in_mode(
|
53
|
+
_OpenTelemetryStabilitySignalType.DATABASE
|
54
|
+
),
|
55
|
+
_StabilityMode.DEFAULT,
|
56
|
+
)
|
57
|
+
|
58
|
+
@stability_mode("http")
|
59
|
+
def test_http_stable_mode(self):
|
60
|
+
self.assertEqual(
|
61
|
+
_OpenTelemetrySemanticConventionStability._get_opentelemetry_stability_opt_in_mode(
|
62
|
+
_OpenTelemetryStabilitySignalType.HTTP
|
63
|
+
),
|
64
|
+
_StabilityMode.HTTP,
|
65
|
+
)
|
66
|
+
|
67
|
+
@stability_mode("http/dup")
|
68
|
+
def test_http_dup_mode(self):
|
69
|
+
self.assertEqual(
|
70
|
+
_OpenTelemetrySemanticConventionStability._get_opentelemetry_stability_opt_in_mode(
|
71
|
+
_OpenTelemetryStabilitySignalType.HTTP
|
72
|
+
),
|
73
|
+
_StabilityMode.HTTP_DUP,
|
74
|
+
)
|
75
|
+
|
76
|
+
@stability_mode("database")
|
77
|
+
def test_database_stable_mode(self):
|
78
|
+
self.assertEqual(
|
79
|
+
_OpenTelemetrySemanticConventionStability._get_opentelemetry_stability_opt_in_mode(
|
80
|
+
_OpenTelemetryStabilitySignalType.DATABASE
|
81
|
+
),
|
82
|
+
_StabilityMode.DATABASE,
|
83
|
+
)
|
84
|
+
|
85
|
+
@stability_mode("database/dup")
|
86
|
+
def test_database_dup_mode(self):
|
87
|
+
self.assertEqual(
|
88
|
+
_OpenTelemetrySemanticConventionStability._get_opentelemetry_stability_opt_in_mode(
|
89
|
+
_OpenTelemetryStabilitySignalType.DATABASE
|
90
|
+
),
|
91
|
+
_StabilityMode.DATABASE_DUP,
|
92
|
+
)
|
93
|
+
|
94
|
+
@stability_mode("database,http")
|
95
|
+
def test_multiple_stability_database_http_modes(self):
|
96
|
+
self.assertEqual(
|
97
|
+
_OpenTelemetrySemanticConventionStability._get_opentelemetry_stability_opt_in_mode(
|
98
|
+
_OpenTelemetryStabilitySignalType.DATABASE
|
99
|
+
),
|
100
|
+
_StabilityMode.DATABASE,
|
101
|
+
)
|
102
|
+
self.assertEqual(
|
103
|
+
_OpenTelemetrySemanticConventionStability._get_opentelemetry_stability_opt_in_mode(
|
104
|
+
_OpenTelemetryStabilitySignalType.HTTP
|
105
|
+
),
|
106
|
+
_StabilityMode.HTTP,
|
107
|
+
)
|
108
|
+
|
109
|
+
@stability_mode("database,http/dup")
|
110
|
+
def test_multiple_stability_database_http_dup_modes(self):
|
111
|
+
self.assertEqual(
|
112
|
+
_OpenTelemetrySemanticConventionStability._get_opentelemetry_stability_opt_in_mode(
|
113
|
+
_OpenTelemetryStabilitySignalType.DATABASE
|
114
|
+
),
|
115
|
+
_StabilityMode.DATABASE,
|
116
|
+
)
|
117
|
+
self.assertEqual(
|
118
|
+
_OpenTelemetrySemanticConventionStability._get_opentelemetry_stability_opt_in_mode(
|
119
|
+
_OpenTelemetryStabilitySignalType.HTTP
|
120
|
+
),
|
121
|
+
_StabilityMode.HTTP_DUP,
|
122
|
+
)
|
123
|
+
|
124
|
+
@stability_mode("database/dup,http")
|
125
|
+
def test_multiple_stability_database_dup_http_stable_modes(self):
|
126
|
+
self.assertEqual(
|
127
|
+
_OpenTelemetrySemanticConventionStability._get_opentelemetry_stability_opt_in_mode(
|
128
|
+
_OpenTelemetryStabilitySignalType.DATABASE
|
129
|
+
),
|
130
|
+
_StabilityMode.DATABASE_DUP,
|
131
|
+
)
|
132
|
+
self.assertEqual(
|
133
|
+
_OpenTelemetrySemanticConventionStability._get_opentelemetry_stability_opt_in_mode(
|
134
|
+
_OpenTelemetryStabilitySignalType.HTTP
|
135
|
+
),
|
136
|
+
_StabilityMode.HTTP,
|
137
|
+
)
|
138
|
+
|
139
|
+
@stability_mode("database,database/dup,http,http/dup")
|
140
|
+
def test_stability_mode_dup_precedence(self):
|
141
|
+
self.assertEqual(
|
142
|
+
_OpenTelemetrySemanticConventionStability._get_opentelemetry_stability_opt_in_mode(
|
143
|
+
_OpenTelemetryStabilitySignalType.DATABASE
|
144
|
+
),
|
145
|
+
_StabilityMode.DATABASE_DUP,
|
146
|
+
)
|
147
|
+
self.assertEqual(
|
148
|
+
_OpenTelemetrySemanticConventionStability._get_opentelemetry_stability_opt_in_mode(
|
149
|
+
_OpenTelemetryStabilitySignalType.HTTP
|
150
|
+
),
|
151
|
+
_StabilityMode.HTTP_DUP,
|
152
|
+
)
|
153
|
+
|
154
|
+
|
155
|
+
class TestOpenTelemetrySemConvStabilityHTTP(TestCase):
|
156
|
+
def test_set_status_for_non_http_code_with_recording_span(self):
|
157
|
+
span = Mock()
|
158
|
+
span.is_recording.return_value = True
|
159
|
+
metric_attributes = {}
|
160
|
+
_set_status(
|
161
|
+
span,
|
162
|
+
metric_attributes,
|
163
|
+
-1,
|
164
|
+
"Exception",
|
165
|
+
sem_conv_opt_in_mode=_StabilityMode.DEFAULT,
|
166
|
+
)
|
167
|
+
|
168
|
+
self.assertIsNone(metric_attributes.get("error.type"))
|
169
|
+
span.set_attribute.assert_not_called()
|
170
|
+
status_call = span.set_status.call_args[0][0]
|
171
|
+
self.assertEqual(status_call.status_code, StatusCode.ERROR)
|
172
|
+
self.assertEqual(
|
173
|
+
status_call.description, "Non-integer HTTP status: " + "Exception"
|
174
|
+
)
|
175
|
+
|
176
|
+
def test_status_code_http_default(self):
|
177
|
+
span = Mock()
|
178
|
+
metrics_attributes = {}
|
179
|
+
_set_status(
|
180
|
+
span=span,
|
181
|
+
metrics_attributes=metrics_attributes,
|
182
|
+
status_code=404,
|
183
|
+
status_code_str="404",
|
184
|
+
server_span=True,
|
185
|
+
sem_conv_opt_in_mode=_StabilityMode.DEFAULT,
|
186
|
+
)
|
187
|
+
# Verify only old conventions are emitted
|
188
|
+
span.set_attribute.assert_called_with("http.status_code", 404)
|
189
|
+
self.assertIn("http.status_code", metrics_attributes)
|
190
|
+
self.assertNotIn("http.response_status_code", metrics_attributes)
|
191
|
+
|
192
|
+
def test_status_code_http_stable(self):
|
193
|
+
span = Mock()
|
194
|
+
metrics_attributes = {}
|
195
|
+
_set_status(
|
196
|
+
span=span,
|
197
|
+
metrics_attributes=metrics_attributes,
|
198
|
+
status_code=200,
|
199
|
+
status_code_str="200",
|
200
|
+
server_span=True,
|
201
|
+
sem_conv_opt_in_mode=_StabilityMode.HTTP,
|
202
|
+
)
|
203
|
+
# Verify only new conventions are emitted
|
204
|
+
span.set_attribute.assert_called_with("http.response.status_code", 200)
|
205
|
+
self.assertIn("http.response.status_code", metrics_attributes)
|
206
|
+
self.assertNotIn("http.status_code", metrics_attributes)
|
207
|
+
|
208
|
+
def test_status_code_http_dup(self):
|
209
|
+
span = Mock()
|
210
|
+
metrics_attributes = {}
|
211
|
+
_set_status(
|
212
|
+
span=span,
|
213
|
+
metrics_attributes=metrics_attributes,
|
214
|
+
status_code=500,
|
215
|
+
status_code_str="500",
|
216
|
+
server_span=True,
|
217
|
+
sem_conv_opt_in_mode=_StabilityMode.HTTP_DUP,
|
218
|
+
)
|
219
|
+
# Verify both old and new conventions are emitted
|
220
|
+
span.set_attribute.assert_any_call("http.status_code", 500)
|
221
|
+
span.set_attribute.assert_any_call("http.response.status_code", 500)
|
222
|
+
self.assertIn("http.status_code", metrics_attributes)
|
223
|
+
self.assertIn("http.response.status_code", metrics_attributes)
|
224
|
+
|
225
|
+
def test_error_status_code_new_mode(self):
|
226
|
+
span = Mock()
|
227
|
+
metrics_attributes = {}
|
228
|
+
_set_status(
|
229
|
+
span=span,
|
230
|
+
metrics_attributes=metrics_attributes,
|
231
|
+
status_code=500,
|
232
|
+
status_code_str="500",
|
233
|
+
server_span=True,
|
234
|
+
sem_conv_opt_in_mode=_StabilityMode.HTTP,
|
235
|
+
)
|
236
|
+
# Verify error type is set for new conventions
|
237
|
+
span.set_attribute.assert_any_call("error.type", "500")
|
238
|
+
self.assertIn("error.type", metrics_attributes)
|
239
|
+
self.assertEqual(metrics_attributes["error.type"], "500")
|
240
|
+
|
241
|
+
def test_non_recording_span(self):
|
242
|
+
span = Mock()
|
243
|
+
span.is_recording.return_value = False
|
244
|
+
metrics_attributes = {}
|
245
|
+
_set_status(
|
246
|
+
span=span,
|
247
|
+
metrics_attributes=metrics_attributes,
|
248
|
+
status_code=200,
|
249
|
+
status_code_str="200",
|
250
|
+
server_span=True,
|
251
|
+
sem_conv_opt_in_mode=_StabilityMode.HTTP_DUP,
|
252
|
+
)
|
253
|
+
# Verify no span attributes are set if not recording
|
254
|
+
span.set_attribute.assert_not_called()
|
255
|
+
span.set_status.assert_not_called()
|
256
|
+
# Verify status code set for metrics independent of tracing decision
|
257
|
+
self.assertIn("http.status_code", metrics_attributes)
|
258
|
+
self.assertIn("http.response.status_code", metrics_attributes)
|
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.50b0 → opentelemetry_instrumentation-0.51b0}/tests/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/tests/test_distro.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{opentelemetry_instrumentation-0.50b0 → opentelemetry_instrumentation-0.51b0}/tests/test_utils.py
RENAMED
File without changes
|