Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(django): Support ASGI requests #666

Merged
merged 3 commits into from
Nov 11, 2024
Merged

Fix(django): Support ASGI requests #666

merged 3 commits into from
Nov 11, 2024

Conversation

GSVarsha
Copy link
Contributor

@GSVarsha GSVarsha commented Nov 5, 2024

What's new?

  • Add support to ASGI requests.

  • Migrate the Django middleware to conform with the new style, from Django 2.0 onwards. By having a single entrypoint to the middleware, __call__, which is wrapped with sync_to_async just once for async requests, we avoid the issue where a ContextVar cannot be reset from a different context.

P.S.

ASGI support new in 3.0
response.headers new in 3.2 (needed to extract custom headers)

@GSVarsha GSVarsha requested a review from a team as a code owner November 5, 2024 10:32
@GSVarsha GSVarsha self-assigned this Nov 5, 2024
@GSVarsha GSVarsha added this to the H2-2024 milestone Nov 5, 2024
@GSVarsha GSVarsha added bug enhancement Review & Merge OTel_migration Migration the code dependency from OpenTracing to OpenTelemetry labels Nov 5, 2024
Copy link
Contributor

@CagriYonca CagriYonca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link
Member

@pvital pvital left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments.

src/instana/instrumentation/django/middleware.py Outdated Show resolved Hide resolved
src/instana/instrumentation/django/middleware.py Outdated Show resolved Hide resolved
src/instana/instrumentation/django/middleware.py Outdated Show resolved Hide resolved
- Migrate Django middleware to new-style

Signed-off-by: Varsha GS <varsha.gs@ibm.com>
Signed-off-by: Varsha GS <varsha.gs@ibm.com>
Signed-off-by: Varsha GS <varsha.gs@ibm.com>
Copy link
Member

@pvital pvital left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me.

@GSVarsha GSVarsha merged commit 827557c into main Nov 11, 2024
14 checks passed
@GSVarsha GSVarsha deleted the django-asgi-support-otel branch November 11, 2024 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug enhancement OTel_migration Migration the code dependency from OpenTracing to OpenTelemetry Review & Merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants