Skip to content

Commit

Permalink
django: Fix carrier usage on ASGI requests
Browse files Browse the repository at this point in the history
For ASGI requests, we must use `request.scope` instead of
`request.META`. This is because `ASGIGetter` retrieves the `headers` key
from the carrier [0], which is only present in `request.scope`.

[0] https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py#L133
  • Loading branch information
adamantike committed Oct 22, 2021
1 parent 3ff06da commit 157c260
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#765](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/765))
- `opentelemetry-instrumentation-pika` now propagates context to basic_consume callback
([#766](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/766))
- `opentelemetry-instrumentation-django` Fixed carrier usage on ASGI requests.
([#767](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/767))

## [1.6.2-0.25b2](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.6.2-0.25b2) - 2021-10-19

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def process_request(self, request):
carrier_getter = wsgi_getter
collect_request_attributes = wsgi_collect_request_attributes

token = attach(extract(request_meta, getter=carrier_getter))
token = attach(extract(carrier, getter=carrier_getter))

span = self._tracer.start_span(
self._get_span_name(request),
Expand Down

0 comments on commit 157c260

Please sign in to comment.