diff --git a/CHANGELOG.md b/CHANGELOG.md index 208876857..070a53c38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `opentelemetry-instrumentation-aiohttp-client` aiohttp: Correct url filter input type ([#843](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/864)) +- `opentelemetry-instrumentation-aiohttp-client` aiohttp: Remove `span_name` from docs + ([#857](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/857)) + ## [1.8.0-0.27b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.8.0-0.27b0) - 2021-12-17 diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py b/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py index 2b6e11cea..515bd126c 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py @@ -23,10 +23,7 @@ Explicitly instrumenting a single client session: .. code:: python import aiohttp - from opentelemetry.instrumentation.aiohttp_client import ( - create_trace_config, - url_path_span_name - ) + from opentelemetry.instrumentation.aiohttp_client import create_trace_config import yarl def strip_query_params(url: yarl.URL) -> str: @@ -35,8 +32,6 @@ Explicitly instrumenting a single client session: async with aiohttp.ClientSession(trace_configs=[create_trace_config( # Remove all query params from the URL attribute on the span. url_filter=strip_query_params, - # Use the URL's path as the span name. - span_name=url_path_span_name )]) as session: async with session.get(url) as response: await response.text() @@ -127,21 +122,6 @@ _ResponseHookT = typing.Optional[ ] -def url_path_span_name(params: aiohttp.TraceRequestStartParams) -> str: - """Extract a span name from the request URL path. - - A simple callable to extract the path portion of the requested URL - for use as the span name. - - :param aiohttp.TraceRequestStartParams params: Parameters describing - the traced request. - - :return: The URL path. - :rtype: str - """ - return params.url.path - - def create_trace_config( url_filter: _UrlFilterT = None, request_hook: _RequestHookT = None, diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py index 30f283a00..800ee1ba6 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py @@ -71,20 +71,6 @@ class TestAioHttpIntegration(TestBase): spans, ) - def test_url_path_span_name(self): - for url, expected in ( - ( - yarl.URL("http://hostname.local:1234/some/path?query=params"), - "/some/path", - ), - (yarl.URL("http://hostname.local:1234"), "/"), - ): - with self.subTest(url=url): - params = aiohttp.TraceRequestStartParams("METHOD", url, {}) - actual = aiohttp_client.url_path_span_name(params) - self.assertEqual(actual, expected) - self.assertIsInstance(actual, str) - @staticmethod def _http_request( trace_config,