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

[core] Add WSGI http header support to HTTP propagator #522

Merged
merged 6 commits into from
Aug 3, 2018

Conversation

Kyle-Verhoog
Copy link
Member

WSGI specification states for variable HTTP headers to be in a particular format stated here.

This PR adds support to the HTTP Propagator to support if and when the Datadog headers are converted to this format.

This should fix #456.

@Kyle-Verhoog Kyle-Verhoog self-assigned this Jul 25, 2018
@Kyle-Verhoog
Copy link
Member Author

Note:

We should still try to run a WSGI server in our tests to replicate this behaviour to prevent future regressions.

tracer = get_dummy_tracer()

headers = {
get_wsgi_header(HTTP_HEADER_TRACE_ID): '1234',

Choose a reason for hiding this comment

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

Use a real input and not get_wsgi_header(), otherwise if the implementation changes, this test will not fail.

with tracer.trace("local_root_span") as span:
eq_(span.trace_id, 1234)
eq_(span.parent_id, 5678)
# TODO: do it for priority too

Choose a reason for hiding this comment

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

Let's add it.

@@ -47,3 +48,22 @@ def test_extract(self):
eq_(span.trace_id, 1234)
eq_(span.parent_id, 5678)
# TODO: do it for priority too

Choose a reason for hiding this comment

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

Here too, and in all other occurrences.

@@ -0,0 +1,7 @@

Choose a reason for hiding this comment

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

no empty lines at the beginning of our modules. Task for the future: enforce a strict flake8 ruleset

HTTP_HEADER_TRACE_ID: '1234',
HTTP_HEADER_PARENT_ID: '5678',
HTTP_HEADER_SAMPLING_PRIORITY: '1',
HTTP_HEADER_TRACE_ID: "1234",

Choose a reason for hiding this comment

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

should we use HTTP_X_DATADOG_TRACE_ID also here?

Copy link
Member Author

Choose a reason for hiding this comment

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

This test is semantically unchanged.

To test the "HTTP_X_DATADOG_TRACE_ID" key we have the test_WSGI_extract test method below.

Choose a reason for hiding this comment

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

My point is to not use a variable but a plain string that detects any change in our code. In general the input must not be generated using our code otherwise the test is not reliable (it changes with our code changes so you don't detect if the software is different). It should be x-datadog-trace-id or similar.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ohhh, okay. I didn't realize that you wanted me to change the functionality on the existing test. I'll make this change.

@Kyle-Verhoog
Copy link
Member Author

@palazzem this should be good to go!

Copy link

@SeanOC SeanOC 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.

@Kyle-Verhoog Kyle-Verhoog added this to the 0.12.2 milestone Aug 3, 2018
@Kyle-Verhoog Kyle-Verhoog dismissed palazzem’s stale review August 3, 2018 20:14

review items were addressed

@Kyle-Verhoog Kyle-Verhoog merged commit 0bae457 into master Aug 3, 2018
@Kyle-Verhoog Kyle-Verhoog deleted the kyle-verhoog/456 branch August 3, 2018 20:15
@palazzem palazzem modified the milestones: 0.12.2, 0.13.0 Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Distributed tracing doesn't work in Django
3 participants