opentelemetry-instrumentation-aiohttp-client 0.38b0__tar.gz → 0.40b0__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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: opentelemetry-instrumentation-aiohttp-client
3
- Version: 0.38b0
3
+ Version: 0.40b0
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
6
  Author-email: OpenTelemetry Authors <cncf-opentelemetry-contributors@lists.cncf.io>
@@ -18,13 +18,14 @@ Classifier: Programming Language :: Python :: 3.10
18
18
  Classifier: Programming Language :: Python :: 3.11
19
19
  Requires-Python: >=3.7
20
20
  Requires-Dist: opentelemetry-api~=1.12
21
- Requires-Dist: opentelemetry-instrumentation==0.38b0
22
- Requires-Dist: opentelemetry-semantic-conventions==0.38b0
23
- Requires-Dist: opentelemetry-util-http==0.38b0
21
+ Requires-Dist: opentelemetry-instrumentation==0.40b0
22
+ Requires-Dist: opentelemetry-semantic-conventions==0.40b0
23
+ Requires-Dist: opentelemetry-util-http==0.40b0
24
24
  Requires-Dist: wrapt<2.0.0,>=1.0.0
25
25
  Provides-Extra: instruments
26
26
  Requires-Dist: aiohttp~=3.0; extra == 'instruments'
27
27
  Provides-Extra: test
28
+ Requires-Dist: http-server-mock; extra == 'test'
28
29
  Requires-Dist: opentelemetry-instrumentation-aiohttp-client[instruments]; extra == 'test'
29
30
  Description-Content-Type: text/x-rst
30
31
 
@@ -26,9 +26,9 @@ classifiers = [
26
26
  ]
27
27
  dependencies = [
28
28
  "opentelemetry-api ~= 1.12",
29
- "opentelemetry-instrumentation == 0.38b0",
30
- "opentelemetry-semantic-conventions == 0.38b0",
31
- "opentelemetry-util-http == 0.38b0",
29
+ "opentelemetry-instrumentation == 0.40b0",
30
+ "opentelemetry-semantic-conventions == 0.40b0",
31
+ "opentelemetry-util-http == 0.40b0",
32
32
  "wrapt >= 1.0.0, < 2.0.0",
33
33
  ]
34
34
 
@@ -38,6 +38,7 @@ instruments = [
38
38
  ]
39
39
  test = [
40
40
  "opentelemetry-instrumentation-aiohttp-client[instruments]",
41
+ "http-server-mock"
41
42
  ]
42
43
 
43
44
  [project.entry-points.opentelemetry_instrumentor]
@@ -179,7 +179,7 @@ def create_trace_config(
179
179
  return
180
180
 
181
181
  http_method = params.method.upper()
182
- request_span_name = f"HTTP {http_method}"
182
+ request_span_name = f"{http_method}"
183
183
  request_url = (
184
184
  remove_url_credentials(trace_config_ctx.url_filter(params.url))
185
185
  if callable(trace_config_ctx.url_filter)
@@ -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.38b0"
15
+ __version__ = "0.40b0"
@@ -23,6 +23,7 @@ from unittest import mock
23
23
  import aiohttp
24
24
  import aiohttp.test_utils
25
25
  import yarl
26
+ from http_server_mock import HttpServerMock
26
27
  from pkg_resources import iter_entry_points
27
28
 
28
29
  from opentelemetry import context
@@ -118,11 +119,11 @@ class TestAioHttpIntegration(TestBase):
118
119
  self.assert_spans(
119
120
  [
120
121
  (
121
- "HTTP GET",
122
+ "GET",
122
123
  (span_status, None),
123
124
  {
124
125
  SpanAttributes.HTTP_METHOD: "GET",
125
- SpanAttributes.HTTP_URL: f"http://{host}:{port}/test-path?query=param#foobar",
126
+ SpanAttributes.HTTP_URL: f"http://{host}:{port}/test-path#foobar",
126
127
  SpanAttributes.HTTP_STATUS_CODE: int(
127
128
  status_code
128
129
  ),
@@ -212,7 +213,7 @@ class TestAioHttpIntegration(TestBase):
212
213
  self.assert_spans(
213
214
  [
214
215
  (
215
- "HTTP GET",
216
+ "GET",
216
217
  (StatusCode.UNSET, None),
217
218
  {
218
219
  SpanAttributes.HTTP_METHOD: "GET",
@@ -246,7 +247,7 @@ class TestAioHttpIntegration(TestBase):
246
247
  self.assert_spans(
247
248
  [
248
249
  (
249
- "HTTP GET",
250
+ "GET",
250
251
  (expected_status, None),
251
252
  {
252
253
  SpanAttributes.HTTP_METHOD: "GET",
@@ -273,7 +274,7 @@ class TestAioHttpIntegration(TestBase):
273
274
  self.assert_spans(
274
275
  [
275
276
  (
276
- "HTTP GET",
277
+ "GET",
277
278
  (StatusCode.ERROR, None),
278
279
  {
279
280
  SpanAttributes.HTTP_METHOD: "GET",
@@ -300,7 +301,7 @@ class TestAioHttpIntegration(TestBase):
300
301
  self.assert_spans(
301
302
  [
302
303
  (
303
- "HTTP GET",
304
+ "GET",
304
305
  (StatusCode.ERROR, None),
305
306
  {
306
307
  SpanAttributes.HTTP_METHOD: "GET",
@@ -313,27 +314,37 @@ class TestAioHttpIntegration(TestBase):
313
314
  def test_credential_removal(self):
314
315
  trace_configs = [aiohttp_client.create_trace_config()]
315
316
 
316
- url = "http://username:password@httpbin.org/status/200"
317
- with self.subTest(url=url):
317
+ app = HttpServerMock("test_credential_removal")
318
318
 
319
- async def do_request(url):
320
- async with aiohttp.ClientSession(
321
- trace_configs=trace_configs,
322
- ) as session:
323
- async with session.get(url):
324
- pass
319
+ @app.route("/status/200")
320
+ def index():
321
+ return "hello"
325
322
 
326
- loop = asyncio.get_event_loop()
327
- loop.run_until_complete(do_request(url))
323
+ url = "http://username:password@localhost:5000/status/200"
324
+
325
+ with app.run("localhost", 5000):
326
+ with self.subTest(url=url):
327
+
328
+ async def do_request(url):
329
+ async with aiohttp.ClientSession(
330
+ trace_configs=trace_configs,
331
+ ) as session:
332
+ async with session.get(url):
333
+ pass
334
+
335
+ loop = asyncio.get_event_loop()
336
+ loop.run_until_complete(do_request(url))
328
337
 
329
338
  self.assert_spans(
330
339
  [
331
340
  (
332
- "HTTP GET",
341
+ "GET",
333
342
  (StatusCode.UNSET, None),
334
343
  {
335
344
  SpanAttributes.HTTP_METHOD: "GET",
336
- SpanAttributes.HTTP_URL: "http://httpbin.org/status/200",
345
+ SpanAttributes.HTTP_URL: (
346
+ "http://localhost:5000/status/200"
347
+ ),
337
348
  SpanAttributes.HTTP_STATUS_CODE: int(HTTPStatus.OK),
338
349
  },
339
350
  )
@@ -380,6 +391,7 @@ class TestAioHttpClientInstrumentor(TestBase):
380
391
  self.get_default_request(), self.URL, self.default_handler
381
392
  )
382
393
  span = self.assert_spans(1)
394
+ self.assertEqual("GET", span.name)
383
395
  self.assertEqual("GET", span.attributes[SpanAttributes.HTTP_METHOD])
384
396
  self.assertEqual(
385
397
  f"http://{host}:{port}/test-path",