-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix tracing module's Jaeger sampling flag #3251
Conversation
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.
LGTM, thanks!
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more.
|
This is currently red as a result of the #3253 mishap. As soon as |
@oleiade you should rebase on master - v0.45.1 is just to backport the fix and release a version/tag to be used in extensions until 0.46.0 a week from now |
@mstoykov wilco! Thanks for the head-up 🙇🏻 |
af55151
to
5ed5b89
Compare
// JaegerUnsampledTraceFlag is the trace-flag value for an unsampled trace. | ||
JaegerUnsampledTraceFlag = "0" | ||
|
||
// JaegerUnsampledTraceFlag is the trace-flag value for a sampled trace. | ||
JaegerUnsampledTraceFlag = "1" | ||
// JaegerSampledTraceFlag is the trace-flag value for a sampled trace. | ||
JaegerSampledTraceFlag = "1" |
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.
This is a bit strange to me. It is a boolean, isn't possible to have a single value so a single source of truth?
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.
This is a small simplification. The sampled/not sampled flag is specified as part of a set of flags: a bit within a byte.
As per the specification it could have a range of values. It just so happens that we're only using the sample flag at the moment, and encode it, at the end of the chain as a string, so keeping the constant as a string is a shortcut that avoids adding conversion code.
Happy to change it to numerical values and do the encoding instead, if you prefer; but I would do it in a different PR (this is a bug fix). Just let me know 👍
What?
This Pull Request contains a fix for the sample flags values being incorrect when using the tracing module's Jaeger propagator.
Why?
As reported by @Blinkuu, the sampling option of the tracing module did not set the trace header flags correctly. That led to traces not being sampled, regardless of the options set on the
instrumentHTTP
called.This was caused by the constant values defining the sampled/unsampled flags being inverted. This Pull Request sets their values back to their specified values. It also adds tests ensuring that we observe the correct flags from the propagators
Propagate
methods under various conditions.Checklist
make ci-like-lint
) and all checks pass.make tests
) and all tests pass.Related PR(s)/Issue(s)
#3212