Skip to content

Commit f46a6e1

Browse files
tammy-baylis-swisrikanthccvshalevr
authored
Request ASGI attributes passed to Sampler (#1762)
* Request ASGI attributes passed to Sampler * Update changelog * aiohttp-client test http.url --------- Co-authored-by: Srikanth Chekuri <[email protected]> Co-authored-by: Shalev Roda <[email protected]>
1 parent c8b0653 commit f46a6e1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
([#1733](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1733))
2020
- Make Django request span attributes available for `start_span`.
2121
([#1730](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1730))
22+
- Make ASGI request span attributes available for `start_span`.
23+
([#1762](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1762))
2224

2325
### Fixed
2426

instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -531,15 +531,16 @@ async def __call__(self, scope, receive, send):
531531

532532
span_name, additional_attributes = self.default_span_details(scope)
533533

534+
attributes = collect_request_attributes(scope)
535+
attributes.update(additional_attributes)
534536
span, token = _start_internal_or_server_span(
535537
tracer=self.tracer,
536538
span_name=span_name,
537539
start_time=None,
538540
context_carrier=scope,
539541
context_getter=asgi_getter,
542+
attributes=attributes,
540543
)
541-
attributes = collect_request_attributes(scope)
542-
attributes.update(additional_attributes)
543544
active_requests_count_attrs = _parse_active_request_count_attrs(
544545
attributes
545546
)

0 commit comments

Comments
 (0)