From d17ca4c38a450229b755c478821a567e0f98e05b Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 17 Apr 2023 15:32:27 -0700 Subject: [PATCH 1/3] Request ASGI attributes passed to Sampler --- .../src/opentelemetry/instrumentation/asgi/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py b/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py index d4653ac50b..6fc88d3eeb 100644 --- a/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py @@ -531,15 +531,16 @@ async def __call__(self, scope, receive, send): span_name, additional_attributes = self.default_span_details(scope) + attributes = collect_request_attributes(scope) + attributes.update(additional_attributes) span, token = _start_internal_or_server_span( tracer=self.tracer, span_name=span_name, start_time=None, context_carrier=scope, context_getter=asgi_getter, + attributes=attributes, ) - attributes = collect_request_attributes(scope) - attributes.update(additional_attributes) active_requests_count_attrs = _parse_active_request_count_attrs( attributes ) From 31298d196f2788180b19b03048623302302f3f9b Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 17 Apr 2023 17:16:56 -0700 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e69e2d091d..4bd32a65f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1733](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1733)) - Make Django request span attributes available for `start_span`. ([#1730](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1730)) +- Make ASGI request span attributes available for `start_span`. + ([#1762](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1762)) ### Fixed From 7d91b86e7d2b9425119e670d647bf535def8ae8c Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 24 Apr 2023 12:04:26 -0700 Subject: [PATCH 3/3] aiohttp-client test http.url --- .../tests/test_aiohttp_client_integration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9210dae702..d9f76f0239 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 @@ -122,7 +122,7 @@ def test_status_codes(self): (span_status, None), { SpanAttributes.HTTP_METHOD: "GET", - SpanAttributes.HTTP_URL: f"http://{host}:{port}/test-path?query=param#foobar", + SpanAttributes.HTTP_URL: f"http://{host}:{port}/test-path#foobar", SpanAttributes.HTTP_STATUS_CODE: int( status_code ),