Skip to content

Commit e69030e

Browse files
authored
aiohttp instrumentation: Remove span_name from docs (#857)
1 parent 895800f commit e69030e

File tree

3 files changed

+4
-35
lines changed

3 files changed

+4
-35
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5151
- `opentelemetry-instrumentation-aiohttp-client` aiohttp: Correct url filter input type
5252
([#843](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/864))
5353

54+
- `opentelemetry-instrumentation-aiohttp-client` aiohttp: Remove `span_name` from docs
55+
([#857](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/857))
56+
5457

5558
## [1.8.0-0.27b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.8.0-0.27b0) - 2021-12-17
5659

instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py

+1-21
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@
2323
.. code:: python
2424
2525
import aiohttp
26-
from opentelemetry.instrumentation.aiohttp_client import (
27-
create_trace_config,
28-
url_path_span_name
29-
)
26+
from opentelemetry.instrumentation.aiohttp_client import create_trace_config
3027
import yarl
3128
3229
def strip_query_params(url: yarl.URL) -> str:
@@ -35,8 +32,6 @@ def strip_query_params(url: yarl.URL) -> str:
3532
async with aiohttp.ClientSession(trace_configs=[create_trace_config(
3633
# Remove all query params from the URL attribute on the span.
3734
url_filter=strip_query_params,
38-
# Use the URL's path as the span name.
39-
span_name=url_path_span_name
4035
)]) as session:
4136
async with session.get(url) as response:
4237
await response.text()
@@ -127,21 +122,6 @@ def response_hook(span: Span, params: typing.Union[
127122
]
128123

129124

130-
def url_path_span_name(params: aiohttp.TraceRequestStartParams) -> str:
131-
"""Extract a span name from the request URL path.
132-
133-
A simple callable to extract the path portion of the requested URL
134-
for use as the span name.
135-
136-
:param aiohttp.TraceRequestStartParams params: Parameters describing
137-
the traced request.
138-
139-
:return: The URL path.
140-
:rtype: str
141-
"""
142-
return params.url.path
143-
144-
145125
def create_trace_config(
146126
url_filter: _UrlFilterT = None,
147127
request_hook: _RequestHookT = None,

instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py

-14
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,6 @@ def assert_spans(self, spans):
7171
spans,
7272
)
7373

74-
def test_url_path_span_name(self):
75-
for url, expected in (
76-
(
77-
yarl.URL("http://hostname.local:1234/some/path?query=params"),
78-
"/some/path",
79-
),
80-
(yarl.URL("http://hostname.local:1234"), "/"),
81-
):
82-
with self.subTest(url=url):
83-
params = aiohttp.TraceRequestStartParams("METHOD", url, {})
84-
actual = aiohttp_client.url_path_span_name(params)
85-
self.assertEqual(actual, expected)
86-
self.assertIsInstance(actual, str)
87-
8874
@staticmethod
8975
def _http_request(
9076
trace_config,

0 commit comments

Comments
 (0)