opentelemetry-instrumentation-aiohttp-client 0.50b0__tar.gz → 0.52b0__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.
@@ -1,10 +1,12 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: opentelemetry-instrumentation-aiohttp-client
3
- Version: 0.50b0
3
+ Version: 0.52b0
4
4
  Summary: OpenTelemetry aiohttp client instrumentation
5
5
  Project-URL: Homepage, https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-aiohttp-client
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,11 +17,12 @@ 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.12
20
- Requires-Dist: opentelemetry-instrumentation==0.50b0
21
- Requires-Dist: opentelemetry-semantic-conventions==0.50b0
22
- Requires-Dist: opentelemetry-util-http==0.50b0
23
+ Requires-Dist: opentelemetry-instrumentation==0.52b0
24
+ Requires-Dist: opentelemetry-semantic-conventions==0.52b0
25
+ Requires-Dist: opentelemetry-util-http==0.52b0
23
26
  Requires-Dist: wrapt<2.0.0,>=1.0.0
24
27
  Provides-Extra: instruments
25
28
  Requires-Dist: aiohttp~=3.0; extra == 'instruments'
@@ -23,12 +23,13 @@ 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.12",
29
- "opentelemetry-instrumentation == 0.50b0",
30
- "opentelemetry-semantic-conventions == 0.50b0",
31
- "opentelemetry-util-http == 0.50b0",
30
+ "opentelemetry-instrumentation == 0.52b0",
31
+ "opentelemetry-semantic-conventions == 0.52b0",
32
+ "opentelemetry-util-http == 0.52b0",
32
33
  "wrapt >= 1.0.0, < 2.0.0",
33
34
  ]
34
35
 
@@ -42,6 +43,7 @@ aiohttp-client = "opentelemetry.instrumentation.aiohttp_client:AioHttpClientInst
42
43
 
43
44
  [project.urls]
44
45
  Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-aiohttp-client"
46
+ Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib"
45
47
 
46
48
  [tool.hatch.version]
47
49
  path = "src/opentelemetry/instrumentation/aiohttp_client/version.py"
@@ -22,6 +22,7 @@ Explicitly instrumenting a single client session:
22
22
 
23
23
  .. code:: python
24
24
 
25
+ import asyncio
25
26
  import aiohttp
26
27
  from opentelemetry.instrumentation.aiohttp_client import create_trace_config
27
28
  import yarl
@@ -29,17 +30,21 @@ Explicitly instrumenting a single client session:
29
30
  def strip_query_params(url: yarl.URL) -> str:
30
31
  return str(url.with_query(None))
31
32
 
32
- async with aiohttp.ClientSession(trace_configs=[create_trace_config(
33
+ async def get(url):
34
+ async with aiohttp.ClientSession(trace_configs=[create_trace_config(
33
35
  # Remove all query params from the URL attribute on the span.
34
36
  url_filter=strip_query_params,
35
- )]) as session:
36
- async with session.get(url) as response:
37
- await response.text()
37
+ )]) as session:
38
+ async with session.get(url) as response:
39
+ await response.text()
40
+
41
+ asyncio.run(get("https://example.com"))
38
42
 
39
43
  Instrumenting all client sessions:
40
44
 
41
45
  .. code:: python
42
46
 
47
+ import asyncio
43
48
  import aiohttp
44
49
  from opentelemetry.instrumentation.aiohttp_client import (
45
50
  AioHttpClientInstrumentor
@@ -49,9 +54,12 @@ Instrumenting all client sessions:
49
54
  AioHttpClientInstrumentor().instrument()
50
55
 
51
56
  # Create a session and make an HTTP get request
52
- async with aiohttp.ClientSession() as session:
53
- async with session.get(url) as response:
54
- await response.text()
57
+ async def get(url):
58
+ async with aiohttp.ClientSession() as session:
59
+ async with session.get(url) as response:
60
+ await response.text()
61
+
62
+ asyncio.run(get("https://example.com"))
55
63
 
56
64
  Configuration
57
65
  -------------
@@ -92,13 +100,13 @@ from opentelemetry import context as context_api
92
100
  from opentelemetry import trace
93
101
  from opentelemetry.instrumentation._semconv import (
94
102
  _get_schema_url,
95
- _HTTPStabilityMode,
96
103
  _OpenTelemetrySemanticConventionStability,
97
104
  _OpenTelemetryStabilitySignalType,
98
105
  _report_new,
99
106
  _set_http_method,
100
107
  _set_http_url,
101
108
  _set_status,
109
+ _StabilityMode,
102
110
  )
103
111
  from opentelemetry.instrumentation.aiohttp_client.package import _instruments
104
112
  from opentelemetry.instrumentation.aiohttp_client.version import __version__
@@ -142,7 +150,7 @@ def _set_http_status_code_attribute(
142
150
  span,
143
151
  status_code,
144
152
  metric_attributes=None,
145
- sem_conv_opt_in_mode=_HTTPStabilityMode.DEFAULT,
153
+ sem_conv_opt_in_mode=_StabilityMode.DEFAULT,
146
154
  ):
147
155
  status_code_str = str(status_code)
148
156
  try:
@@ -169,7 +177,7 @@ def create_trace_config(
169
177
  request_hook: _RequestHookT = None,
170
178
  response_hook: _ResponseHookT = None,
171
179
  tracer_provider: TracerProvider = None,
172
- sem_conv_opt_in_mode: _HTTPStabilityMode = _HTTPStabilityMode.DEFAULT,
180
+ sem_conv_opt_in_mode: _StabilityMode = _StabilityMode.DEFAULT,
173
181
  ) -> aiohttp.TraceConfig:
174
182
  """Create an aiohttp-compatible trace configuration.
175
183
 
@@ -326,7 +334,7 @@ def _instrument(
326
334
  trace_configs: typing.Optional[
327
335
  typing.Sequence[aiohttp.TraceConfig]
328
336
  ] = None,
329
- sem_conv_opt_in_mode: _HTTPStabilityMode = _HTTPStabilityMode.DEFAULT,
337
+ sem_conv_opt_in_mode: _StabilityMode = _StabilityMode.DEFAULT,
330
338
  ):
331
339
  """Enables tracing of all ClientSessions
332
340
 
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = "0.50b0"
15
+ __version__ = "0.52b0"
@@ -29,8 +29,8 @@ from opentelemetry import trace as trace_api
29
29
  from opentelemetry.instrumentation import aiohttp_client
30
30
  from opentelemetry.instrumentation._semconv import (
31
31
  OTEL_SEMCONV_STABILITY_OPT_IN,
32
- _HTTPStabilityMode,
33
32
  _OpenTelemetrySemanticConventionStability,
33
+ _StabilityMode,
34
34
  )
35
35
  from opentelemetry.instrumentation.aiohttp_client import (
36
36
  AioHttpClientInstrumentor,
@@ -150,7 +150,7 @@ class TestAioHttpIntegration(TestBase):
150
150
  path = "test-path?query=param#foobar"
151
151
  host, port = self._http_request(
152
152
  trace_config=aiohttp_client.create_trace_config(
153
- sem_conv_opt_in_mode=_HTTPStabilityMode.HTTP
153
+ sem_conv_opt_in_mode=_StabilityMode.HTTP
154
154
  ),
155
155
  url=f"/{path}",
156
156
  status_code=status_code,
@@ -173,7 +173,7 @@ class TestAioHttpIntegration(TestBase):
173
173
  path = "test-path?query=param#foobar"
174
174
  host, port = self._http_request(
175
175
  trace_config=aiohttp_client.create_trace_config(
176
- sem_conv_opt_in_mode=_HTTPStabilityMode.HTTP_DUP
176
+ sem_conv_opt_in_mode=_StabilityMode.HTTP_DUP
177
177
  ),
178
178
  url=f"/{path}",
179
179
  status_code=status_code,
@@ -213,7 +213,7 @@ class TestAioHttpIntegration(TestBase):
213
213
  with self.subTest(status_code=200):
214
214
  self._http_request(
215
215
  trace_config=aiohttp_client.create_trace_config(
216
- sem_conv_opt_in_mode=_HTTPStabilityMode.HTTP
216
+ sem_conv_opt_in_mode=_StabilityMode.HTTP
217
217
  ),
218
218
  url="/test-path?query=param#foobar",
219
219
  status_code=200,
@@ -230,7 +230,7 @@ class TestAioHttpIntegration(TestBase):
230
230
  with self.subTest(status_code=200):
231
231
  self._http_request(
232
232
  trace_config=aiohttp_client.create_trace_config(
233
- sem_conv_opt_in_mode=_HTTPStabilityMode.HTTP_DUP
233
+ sem_conv_opt_in_mode=_StabilityMode.HTTP_DUP
234
234
  ),
235
235
  url="/test-path?query=param#foobar",
236
236
  status_code=200,
@@ -398,7 +398,7 @@ class TestAioHttpIntegration(TestBase):
398
398
 
399
399
  host, port = self._http_request(
400
400
  trace_config=aiohttp_client.create_trace_config(
401
- sem_conv_opt_in_mode=_HTTPStabilityMode.HTTP
401
+ sem_conv_opt_in_mode=_StabilityMode.HTTP
402
402
  ),
403
403
  url="/test",
404
404
  request_handler=request_handler,
@@ -426,7 +426,7 @@ class TestAioHttpIntegration(TestBase):
426
426
 
427
427
  host, port = self._http_request(
428
428
  trace_config=aiohttp_client.create_trace_config(
429
- sem_conv_opt_in_mode=_HTTPStabilityMode.HTTP_DUP
429
+ sem_conv_opt_in_mode=_StabilityMode.HTTP_DUP
430
430
  ),
431
431
  url="/test",
432
432
  request_handler=request_handler,
@@ -546,7 +546,7 @@ class TestAioHttpIntegration(TestBase):
546
546
  def test_nonstandard_http_method_new_semconv(self):
547
547
  trace_configs = [
548
548
  aiohttp_client.create_trace_config(
549
- sem_conv_opt_in_mode=_HTTPStabilityMode.HTTP
549
+ sem_conv_opt_in_mode=_StabilityMode.HTTP
550
550
  )
551
551
  ]
552
552
  app = HttpServerMock("nonstandard_method")