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

Distributed tracing doesn't work in Django #456

Closed
keattang opened this issue Apr 25, 2018 · 4 comments · Fixed by #522
Closed

Distributed tracing doesn't work in Django #456

keattang opened this issue Apr 25, 2018 · 4 comments · Fixed by #522
Assignees
Labels
Milestone

Comments

@keattang
Copy link

Specifying DISTRIBUTED_TRACING=True in the Django Datadog settings doesn't work because the propagator looks for the x-datadog-trace-id header in the Django request.META object which converts the header name to HTTP_X_DATADOG_TRACE_ID. For more details on this see here.

In order to work around this I've had to monkey patch the library so that it looks for the headers with the correct keys:

from ddtrace.propagation import http
http.HTTP_HEADER_TRACE_ID = 'HTTP_X_DATADOG_TRACE_ID'
http.HTTP_HEADER_PARENT_ID = 'HTTP_X_DATADOG_PARENT_ID'
http.HTTP_HEADER_SAMPLING_PRIORITY = 'HTTP_X_DATADOG_SAMPLING_PRIORITY'
@palazzem palazzem added the bug label Apr 26, 2018
@palazzem
Copy link

Thanks @keattang ! We'll investigate on that as soon the current 0.12 is out! I'll keep you updated.

@praseodym
Copy link

The monkeypatch works for us, but it would be great to see this fixed in the library.

@Kyle-Verhoog
Copy link
Member

Hi all, looking into this issue now.

From what I can tell this behaviour is defined in the WSGI spec: https://www.python.org/dev/peps/pep-3333/#environ-variables so this shouldn't be an issue with just Django.

I think it makes sense to change our HTTP propagator to check for the converted headers as well when extracting.

@Kyle-Verhoog
Copy link
Member

@praseodym @keattang we'll be including the fix for this issue in our upcoming release! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants