-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Tracing: Add Jaeger B3 header support #5553
Conversation
Signed-off-by: Andrew Hayworth <ahayworth@gmail.com>
9cc017f
to
fd3cac1
Compare
cc @fpetkovski, since I think you may be interested in this. |
Signed-off-by: Andrew Hayworth <ahayworth@gmail.com>
fd3cac1
to
ccf60d4
Compare
Signed-off-by: Andrew Hayworth <ahayworth@gmail.com>
ccf60d4
to
e8f08d0
Compare
Jaeger tracing uses its own HTTP/GRPC header to perform context propagation between services - "uber-trace-id". However, Jaeger tracing clients also support context propagation via the B3 header format (as popularized by Zipkin tracing). This commit adds support for configuring the B3 header format within thanos tracing. The main motivation for doing this is interoperability with other systems that may call into or out of Thanos components - for example, Grafana or Envoy - both of which support Jaeger tracing, but use B3 headers instead of the Jaeger-specific "uber-trace-id" format headers. Unfortunately, we cannot directly toggle this as an option or configure it via the environment; the jaeger-go library requires us to pass it in as an option when we call `NewTracer`. In order to facilitate this, we extend the `ParseConfigFromYaml` file to not only return a _Jaeger_ configuration object, but the actual YAML configuration object as well. This allows us to check and see if the user requested this kind of header propagation, and we can then construct the necessary additional options to `NewTracer`. Of course, this is all legacy configuration in many ways. The tracing world is rapidly moving towards OpenTelemetry and W3C headers for context propagation. However, there is still utility in supporting B3 headers until everyone (including Thanos!) finishes their OpenTelemetry migration projects. Signed-off-by: Andrew Hayworth <ahayworth@gmail.com>
Signed-off-by: Andrew Hayworth <ahayworth@gmail.com>
e8f08d0
to
4183815
Compare
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.
Is there a reason not to add these by default?
Since we have another WIP pr for jaeger Opentelemetry migration, maybe it is better to have this after #5411 is done? |
@GiedriusS That depends on exactly what you mean with the question.
@yeya24 If that's going to merge soon, then perhaps it is better to wait. My impression was that the PR may not be close to merging given the length of time it has been open, but that impression may have been mistaken! 😄 That said - it looks like #5411 would opentracing "basic" propagation for all supported tracing backends, which may not be what is desired (or intended). There's a new |
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Looks like this PR is not ready for review. Does it make sense to focus efforts there @ahayworth ? |
It was at the time it was submitted! 😄 But, it would have to be reworked since #5411 merged.
No, I don't think so (and I won't continue this PR). #5411 allows me to solve the problem of interoperability that I faced in an entirely different way: using OpenTelemetry native tracing and propagation. (Not even just different, I think it's a better solution!). I'll close this for now, but if anyone else needs this support in the future the PR can serve as a helpful guide for anyone that looks to implement B3 header support for the legacy Jaeger tracing. |
Changes
Jaeger tracing uses its own HTTP/GRPC header to perform context
propagation between services - "uber-trace-id". However, Jaeger
tracing clients also support context propagation via the B3 header
format (as popularized by Zipkin tracing).
This commit adds support for configuring the B3 header format within
thanos tracing. The main motivation for doing this is interoperability
with other systems that may call into or out of Thanos components - for
example, Grafana or Envoy - both of which support Jaeger tracing, but
use B3 headers instead of the Jaeger-specific "uber-trace-id" format headers.
Unfortunately, we cannot directly toggle this as an option or configure
it via the environment; the jaeger-go library requires us to pass it in
as an option when we call
NewTracer
. In order to facilitate this, weextend the
ParseConfigFromYaml
file to not only return a Jaegerconfiguration object, but the actual YAML configuration object as well.
This allows us to check and see if the user requested this kind of
header propagation, and we can then construct the necessary additional
options to
NewTracer
.Of course, this is all legacy configuration in many ways. The tracing
world is rapidly moving towards OpenTelemetry and W3C headers for
context propagation. However, there is still utility in supporting B3
headers until everyone (including Thanos!) finishes their OpenTelemetry
migration projects.
Verification
Programmatically testing this change is tricky, because we need to actually
inspect the headers of the HTTP and GRPC requests that flow through the
system with tracing enabled. I was able to verify that this worked through
manual testing via the query frontend:
between the query frontend and a downstream querier (I configured it
statically for port 10904, which is one of the querier ports).
to receive and display traces.
scripts/quickstart.sh
to:query-frontend.downstream-url
pointedto the intercepting
ngrok
tunnel.Once those modifications were in place and launched with
make quickstart
,I was able to write queries in the query frontend, see that the intercepted
API calls to the downstream querier contained tracing headers in the
expected format, and verify that the traces were ingested into the Jaeger
backend via the OpenTelemetry collector (the OpenTelemetry collector was not
strictly necessary, but I prefer to use it while debugging).
Screenshot showing the intercepted API request, with correct B3 headers:
Screenshot of the complete trace ingested to the Jaeger backend, with
correct context-propagation and parent/child span relationships preserved: