-
Notifications
You must be signed in to change notification settings - Fork 15
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
Tolerates reads of 128 bit X-B3-TraceId #61
Conversation
ps I just googled and looked at travis to figure out how to do this :) if there's anything not idiomatic please let me know. |
@@ -103,11 +103,20 @@ def test_is_tracing_returns_what_tracing_percent_method_returns_for_rest( | |||
|
|||
|
|||
def test_get_trace_id_returns_header_value_if_present(dummy_request): | |||
dummy_request.headers = {'X-B3-TraceId': '17133d482ba4f605'} | |||
dummy_request.headers = {'X-B3-TraceId': '48485a3953bb6124'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed the existing test, as it more clearly shows the generator isn't being used
1 similar comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! One tiny change then I'll merge it in.
dummy_request.registry.settings = { | ||
'zipkin.trace_id_generator': lambda r: '17133d482ba4f605', | ||
} | ||
assert '17133d482ba4f605' == request_helper.get_trace_id(dummy_request) | ||
assert '48485a3953bb6124' == request_helper.get_trace_id(dummy_request) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: could you add another blank line here? We enforce this via flake8, and indeed the travis build for this branch has failed. I believe make test
is the "run-all-tests" invocation we generally use. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. thanks for the tip, too!
The first step of transitioning to 128bit `X-B3-TraceId` is tolerantly reading 32 character long ids by throwing away the high bits (any characters left of 16 characters). This allows the tracing system to more flexibly introduce 128bit trace id support in the future. Ex. when `X-B3-TraceId: 463ac35c9f6413ad48485a3953bb6124` is received, parse the lower 64 bits (right most 16 characters ex48485a3953bb6124) as the trace id.
The first step of transitioning to 128bit
X-B3-TraceId
is tolerantly reading 32 character long ids by throwing away the high bits (any characters left of 16 characters). This allows the tracing system to more flexibly introduce 128bit trace id support in the future.Ex. when
X-B3-TraceId: 463ac35c9f6413ad48485a3953bb6124
is received, parse the lower 64 bits (right most 16 characters ex48485a3953bb6124) as the trace id.See openzipkin/b3-propagation#6