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 <srikanth.chekuri92@gmail.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
This commit is contained in:
Tammy Baylis
2023-04-28 09:47:51 -07:00
committed by GitHub
parent c8b06539c0
commit f46a6e1c0e
2 changed files with 5 additions and 2 deletions

View File

@ -19,6 +19,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

View File

@ -531,15 +531,16 @@ class OpenTelemetryMiddleware:
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
)