Change span injection/extraction from HTTP request #821
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Today,
TextMap
format is used when injecting or extracing span from HTTP requests.This format will treat the HTTP header value (that contains the span) as is (without decoding). Conversely the
HTTPHeaders
format will try to URL decode the value first.The issue is that some opentracing clients like java jaeger client is URL encoding the HTTP header value before sending it over the wire. Then when the server receive the request and try to extract the span from it it will fail if
TextMap
format is used isteadHTTPHeaders
format.For example the java jaeger client will send something like this:
Uber-Trace-Id: 9ec076efd89825a%3A9c876c01059545b2%3Ab9ec076efd89825a%3A1
but the golang jaeger client is expecting thisUber-Trace-Id: 9ec076efd89825a:9c876c01059545b2:b9ec076efd89825a:1
when theTextMap
format is used.In this case the call results to the following error:
String does not match tracer state format
Because the
http.go
file is used precisely for dealing with span in a HTTP context, I propose to default the span format toHTTPHeaders