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

Tolerates reads of 128 bit X-B3-TraceId #61

Merged
merged 1 commit into from
Sep 23, 2016
Merged

Tolerates reads of 128 bit X-B3-TraceId #61

merged 1 commit into from
Sep 23, 2016

Conversation

codefromthecrypt
Copy link
Contributor

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

@codefromthecrypt
Copy link
Contributor Author

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'}
Copy link
Contributor Author

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

@coveralls
Copy link

coveralls commented Sep 22, 2016

Coverage Status

Coverage remained the same at 100.0% when pulling 5e2a02f on adriancole:128-bit into b0ca378 on Yelp:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 5e2a02f on adriancole:128-bit into b0ca378 on Yelp:master.

Copy link

@mjbryant mjbryant 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! 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)

Copy link

@mjbryant mjbryant Sep 22, 2016

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. :)

Copy link
Contributor Author

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.
@coveralls
Copy link

coveralls commented Sep 23, 2016

Coverage Status

Coverage remained the same at 100.0% when pulling 7926d1e on adriancole:128-bit into b0ca378 on Yelp:master.

@mjbryant mjbryant merged commit be664c5 into Yelp:master Sep 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants