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

B3 header support #749

Closed
wants to merge 4 commits into from

Conversation

crispywalrus
Copy link
Contributor

@crispywalrus crispywalrus commented Jan 2, 2019

Problem

OpenZipkin has created a new set of header to carry trace information. These headers are not compatible with the old ones and are needed to interoperate with services that use the new version of the header.

Solution

If a "b3" header exists in the request this extracts all the new information and populates finagles tracing header with the existing values.

@CLAassistant
Copy link

CLAassistant commented Jan 2, 2019

CLA assistant check
All committers have signed the CLA.

@crispywalrus
Copy link
Contributor Author

@adriancole @mosesn this is the result of the last changes to crispywalrus#1 to add OpenZipkin support to finagle.

Copy link
Contributor

@codefromthecrypt codefromthecrypt 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, just needs a unit test. clever approach

def handleSampled(headers: HeaderMap,value: String): Unit =
value match {
case "0" => headers.set(Header.Flags,"0")
case "d" => headers.set(Header.Flags,"1")
Copy link
Contributor

Choose a reason for hiding this comment

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

don't recall if in scala case falls through, but debug implies sampled. so you could also set the sampled header here

@codecov-io
Copy link

Codecov Report

Merging #749 into develop will decrease coverage by <.01%.
The diff coverage is 13.63%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #749      +/-   ##
===========================================
- Coverage    69.31%   69.31%   -0.01%     
===========================================
  Files          765      765              
  Lines        24397    24419      +22     
  Branches      1829     1811      -18     
===========================================
+ Hits         16911    16925      +14     
- Misses        7486     7494       +8
Impacted Files Coverage Δ
...n/scala/com/twitter/finagle/http/HttpTracing.scala 91.66% <100%> (+0.75%) ⬆️
...ain/scala/com/twitter/finagle/http/TraceInfo.scala 65.67% <9.52%> (-25.64%) ⬇️
.../http2/transport/Http2NegotiatingTransporter.scala 86.56% <0%> (-5.98%) ⬇️
...tter/finagle/redis/protocol/commands/Streams.scala 98.75% <0%> (+1.25%) ⬆️
...nagle/http2/transport/StreamTransportFactory.scala 82.14% <0%> (+1.58%) ⬆️
...com/twitter/finagle/netty4/ConnectionBuilder.scala 75% <0%> (+1.92%) ⬆️
.../com/twitter/finagle/tracing/BroadcastTracer.scala 66% <0%> (+18%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a423e16...dd85c59. Read the comment docs.

@kevinoliver
Copy link
Contributor

This approach seems reasonable. I'd like to see some unit tests before going forward.

@luciferous
Copy link
Collaborator

Hi @crispywalrus, how is testing going? Is there anything we can do to assist?

Copy link
Contributor

@kevinoliver kevinoliver left a comment

Choose a reason for hiding this comment

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

reiterating the request for unit tests

so should this remove the "b3" header, and if so how does it get added back in in downstream HTTP calls?
named `TraceContext`
+ break out the new convertions logic from the current handler
+ rename the parse field handlers to match their function not field
added a removal of the b3 header as internally span/trace management
works on the X-B3 versions and it seems prudent to make sure there
isn't a conflict
@crispywalrus
Copy link
Contributor Author

@kevinoliver this adds some basic test that show a b3 header ends up being parsed into finagles X-B3 headers. I've chosen to remove the b3 header as internal code produces X-B3 headers and it cuase problems to have both versions in my test rig. Sorry this took so long to finish off.

@codefromthecrypt
Copy link
Contributor

hey folks. can you help get this merged? @crispywalrus has responded and we are nearing a year on the original feature request.

finaglehelper pushed a commit that referenced this pull request Jun 28, 2019
Problem

OpenZipkin has created a new set of header to carry
trace information. These headers are not compatible
with the old ones and are needed to interoperate
with services that use the new version of the header.

Solution

If a "b3" header exists in the request this extracts
all the new information and populates finagles
tracing header with the existing values.

#749
Signed-off-by: Ian Bennett <[email protected]>

Differential Revision: https://phabricator.twitter.biz/D334419
@enbnt enbnt closed this Jun 28, 2019
@crispywalrus
Copy link
Contributor Author

@enbnt why did this get closed?

@enbnt
Copy link
Contributor

enbnt commented Jun 28, 2019

@crispywalrus because it has landed in 8721837 😄

@crispywalrus
Copy link
Contributor Author

Great!

@luciferous
Copy link
Collaborator

Thanks for the patience, everyone!

@crispywalrus crispywalrus deleted the b3-header-support branch July 16, 2019 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

7 participants