-
Notifications
You must be signed in to change notification settings - Fork 48
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
Remove dependency on opentelemetry-go #267
Conversation
Move necessary types and parsing logic from OpenTelemetry propagators and tracestate implementation into beeline so we can break the dependency on the OTel packages.
126bd33
to
e42fdbe
Compare
@@ -285,9 +283,10 @@ func TestB3TraceContext(t *testing.T) { | |||
ParentID: "b7ad6b7169203331", | |||
} | |||
ctx, headers := MarshalB3TraceContext(context.Background(), prop) | |||
assert.Equal(t, 4, len(headers), "B3 Trace Context should have three headers") |
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.
The text says "three" but the test used to assert 4?
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.
@vreynolds so funny enough, this was a bug. Because of this section of code in b3.go
:
for _, key := range propagator.Fields() {
headerMap[key] = supp.Get(key)
}
We were always setting x-b3-flags
with no value. This is technically incorrect, so we're fixing the bug in this PR. I can't think of any functionality that would depend on this bug, since the header value doesn't exist.
The beeline currently has dependencies on multiple OpenTelemetry packages. These were introduced to provide support for parsing and generating trace context headers using W3C Trace Context and B3 header formats. This PR breaks that dependency by adding the following types (taken from opentelemetry-go) to the propagation package in the beeline:
TraceFlags
- also exposed inpropagation.PropagationContext
IsSampled() bool
WithSampled(sampled bool) TraceFlags
MarshalJSON() ([]byte, error)
String() string
FlagsSampled
- a constant used in the TraceFlags bit-maskAdditionally, the parsing and generating logic for B3 headers has been taken from the OTel B3 propagator.