-
Notifications
You must be signed in to change notification settings - Fork 97
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
feat(gateway): trace context header support #256
Conversation
Codecov Report
@@ Coverage Diff @@
## main #256 +/- ##
==========================================
- Coverage 48.13% 47.35% -0.79%
==========================================
Files 270 270
Lines 33034 33115 +81
==========================================
- Hits 15901 15680 -221
- Misses 15470 15757 +287
- Partials 1663 1678 +15
|
4614ea9
to
53a2de0
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.
Simpler and clearer.
I think we are getting otel wrong, we set globals and force tracing onto everyone. I belive we should have options where consumers must pass a tracer or propagator or ... in order to enable tracing, else it does nothing. Doing dependency injection instead of setting globals. |
@Jorropo did you run the example tests with your suggestions? The header is then not present. If you manage to make it work, I will apply your suggestions. I tried exactly what you did first, and it didn't work. That's why I did it the way I did. |
@hacdias no but we dont expect to see a header. We want the gateway to be a children of Saturn, Nginx front end, ... this needs to accept not emit traceparent headers. fwiw this already work for cmds in Kubo. |
@Jorropo hmm... how can we then test if it's working properly? Afaik, that's the reason it wasn't added in ipfs/kubo#9169, but then the tests from ipfs/kubo#9180 are also invalid. |
@hacdias you can test it yourself and send a screenshot i dont think this require ci. |
Okay, I had to read more about this. Indeed, my impression is that we should not emit headers, only accept them and pass them down.
(This is also the only section where responses are mentioned, hence my conclusion.) But also, "Vendors should ensure that they include only these response headers when responding to systems that participated in the trace." is not very clear to me. If I send a -- Then, I don't understand why the initial issue for this subject was to add |
53a2de0
to
e74d6ea
Compare
After reading the specification, I think @Jorropo is right. The specification clearly states that the
Therefore, there isn't much to do. This PR adds OTel tracing to the example to show how it should be added, as an example. It also changes the default HTTP Client for the examples such that we use the I want to add that we already have tracing spans in all handlers and in the IPFSBackend. I made the naming consistent in #261. The data is there. It is now the responsibility of the user of |
941be78
to
a0392dc
Compare
a0392dc
to
6bde37f
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.
We need to add a test for this, to protect from refactor-driven regressions in the future.
Perhaps examples/gateway/proxy
? It provides good setup for this.
Enable a tracing reporter and test with and without traceparent
in request, and then make assert if it was also passed to the proxy backend.
c76cb01
to
8e43931
Compare
6bde37f
to
3b5b682
Compare
@lidel I added two tests:
An important thing to note is that for all of this to work, we have to use |
3b5b682
to
3645315
Compare
41e5c10
to
9b5e696
Compare
9b5e696
to
9f4acdf
Compare
b5b6989
to
0ca7e90
Compare
c2ae3fc
to
2127127
Compare
2127127
to
a56c841
Compare
I updated the main comment #256 (comment) with the current information. |
bf988f2
to
a1d9f98
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.
I took this for a spin with Jaeger UI in both Kubo (ipfs/kubo#9811) and bifrost-gateway (ipfs-inactive/bifrost-gateway#74) and as far i could tell works as expected.
Kubo | bifrost-gw with GRAPH_BACKEND=true |
---|---|
Merging so we can leverage traceparent
in bifrost-gateway for Rhea, but also can start leveraging it in places like IPNI HTTP client at https://github.com/ipfs/boxo/tree/main/routing/http/client
Ref.
This PR:
tracing
sub-package based on Kubo's in order to supportOTEL_TRACES_EXPORTER
easily across the stack. This may be removed in the future, onceopentelemetry-go
supports it by default.docs/tracing.md
on how to use tracing including a script on how to generate atraceparent
header.trace-id
. I would avoid using the exact same headers in Trace Context spec as per https://www.w3.org/TR/trace-context/#other-risks