Pass request attributes to Sampler in Django (#1730)

This commit is contained in:
Rafael Muñoz
2023-03-31 16:04:57 +02:00
committed by GitHub
parent 4e059b15d2
commit 27d6706f90
2 changed files with 4 additions and 1 deletions

View File

@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1645](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1645))
- Add `excluded_urls` functionality to `urllib` and `urllib3` instrumentations
([#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))
### Fixed

View File

@ -212,6 +212,7 @@ class _DjangoMiddleware(MiddlewareMixin):
carrier_getter = wsgi_getter
collect_request_attributes = wsgi_collect_request_attributes
attributes = collect_request_attributes(carrier)
span, token = _start_internal_or_server_span(
tracer=self._tracer,
span_name=self._get_span_name(request),
@ -220,9 +221,9 @@ class _DjangoMiddleware(MiddlewareMixin):
),
context_carrier=carrier,
context_getter=carrier_getter,
attributes=attributes,
)
attributes = collect_request_attributes(carrier)
active_requests_count_attrs = _parse_active_request_count_attrs(
attributes
)