-
Notifications
You must be signed in to change notification settings - Fork 714
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
[BUG] DEBUG-trace is not always reported #661
Comments
@adriancole comment from openzipkin/openzipkin.github.io#31 (comment) says:
That is currently no longer the case and I think that would resolve this issue! |
If I understand you correctly.. you have set `X-B3-Flags: 1` and not
`X-B3-Sampled:
1`
You are right that according to how below was written it would seem this
should work
https://github.com/openzipkin/b3-propagation
However, that is more likely just an accident of how it is written.
Are you unable to set `X-B3-Sampled: 1`? Is there any open source library
that allows you to leave out `X-B3-Sampled: 1` when setting `X-B3-Flags:
1`?
I don't mind changing this impl, just concerned you may end up needing to
request this in every library..
|
Yes, brave instrumentation does exactly that ? :-) Both in the B3-Propagation spec & the implementation, the sampled flag is not injected in the carrier if debug is enabled. See
|
It is true the b3-propagation spec suggests debug implies sampled. This leniently parses a missing `X-B3-Sampled` header as long as `X-B3-Flags: 1` is present. Fixes #661
anyway I agree! let's get this fixed |
It is true the b3-propagation spec suggests debug implies sampled. This leniently parses a missing `X-B3-Sampled` header as long as `X-B3-Flags: 1` is present. Fixes #661
release 4.18.2 is on the way. Thank you so much! |
Thank you very much for fixing this so fast! I had some feedback on the PR ... but okay ;-) |
Assumption: even using NEVER_SAMPLE, a debug trace should always be sampled.
From the B3-Propagation spec:
There is a bug under the following conditions:
Actual result: the
X-B3-Flags: 1
trace is NOT sampled.Expected result: the
X-B3-Flags: 1
trace IS sampled.According to the B3-Propagation spec, this set of propagation headers are expected in a downstream service:
In the method
B3Propagation#extract(C carrier)
the parameters are extracted from the carrier and aTraceContextOrSamplingFlags
is returned. This object is created withTraceContextOrSamplingFlags.create(result.sampled(sampledV).debug(debug).build())
which is a TraceContext with fieldflags = 8
.This results in
traceContext.debug()
returningtrue
andtraceContext.sampled()
returningnull
. Strictly speaking, this is correct: the extractor only found a debug flag and not a sampling decision. Please note that this is a bit of an anomaly: forSamplingFlags.DEBUG
both the fieldssampled
anddebug
are set totrue
.But let's assume that a TraceContext with debug enabled, without a sampling decision set, is correct:
In
Tracer#joinSpan(TraceContext context)
the context is queried to find out a sampling decision has been made or not:The sampler is asked to make a decision on wether this trace should be sampled or not. Note that
.debug()
is never checked. If the sampler makes the decision to not sample this trace, the new context has the flags:sample=false
anddebug=true
.At that point,
Tracer#toSpan(TraceContext context)
is called with the newly constructed context. The testBoolean.TRUE.equals(decorated.sampled())
returns false and aNoopSpan.create(decorated)
is returned.Result: A
NoopSpan
is returned and the DEBUG-trace is NOT sampled/recorded/reported.So which part is wrong ?
B3Propagation
extractor by correctly extracting thedebug
flag, but not settingsampled=true
?Tracer
asking the sampler for a sampling decision, without checking thecontext.debug()
state first ?I can provide a failing unit test for both root-causes, but probably only one is valid ?!
The text was updated successfully, but these errors were encountered: