Skip to content

Commit b9a8d76

Browse files
committed
Pass request attributes to Sampler in Django
1 parent e4d8f10 commit b9a8d76

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
([#1690](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1690))
1818
- Add metrics instrumentation for sqlalchemy
1919
([#1645](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1645))
20+
- Make Django request span attributes available for `start_span`.
21+
([#1730](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1730))
22+
2023

2124
### Fixed
2225

instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/middleware/otel_middleware.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ def process_request(self, request):
212212
carrier_getter = wsgi_getter
213213
collect_request_attributes = wsgi_collect_request_attributes
214214

215+
attributes = collect_request_attributes(carrier)
215216
span, token = _start_internal_or_server_span(
216217
tracer=self._tracer,
217218
span_name=self._get_span_name(request),
@@ -220,9 +221,9 @@ def process_request(self, request):
220221
),
221222
context_carrier=carrier,
222223
context_getter=carrier_getter,
224+
attributes=attributes,
223225
)
224226

225-
attributes = collect_request_attributes(carrier)
226227
active_requests_count_attrs = _parse_active_request_count_attrs(
227228
attributes
228229
)

0 commit comments

Comments
 (0)