-
Notifications
You must be signed in to change notification settings - Fork 434
[DO NOT MERGE] Add tracing instrumentation #941
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
Conversation
|
f1a0993
to
efaac91
Compare
c54e440
to
ee8e006
Compare
I'm currently finishing up the server span attributes. Per Otel spec, we should either add HTTP attributes to the same Span or create a child Span of the gRPC span for the HTTP transport:
|
Try what is simpler for now (so just one span I guess) and let's try doing the client as well so we can show two grpc services talking to one another, and then we continue improving the span quality perhaps? I can use some tracer I have to see how it works in action once we have an end-to-end :) |
ee8e006
to
806b633
Compare
Sounds good 👌 |
6a1ebce
to
b82c132
Compare
I added these HTTP attributes on the server span:
I'm not sure where to extract values for the following recommended attributes though:
@glbrntt Do you have an idea for some of those? For reference, here's a list of the attributes Otel recommends for HTTP spans: https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/http.md#http-client-server-example |
We should be able to get this from the headers in the routing handler, I think.
We can get this from the
Hmm. This is unfortunate, this is in the request headers but it gets stripped by the HTTP2 to HTTP1 codec. We drop down to using HTTP/1 concepts in the pipeline so that supporting gRPC-Web (i.e. gRPC-ish over HTTP/1) is easier. We were thinking of changing this so that we always speak HTTP/2 in the pipeline and then only convert back to HTTP/1 if we absolutely have to for gRPC-Web.
Isn't this just
This suggests that we'd have to pull this from the request headers in the routing handler, most likely.
I think this is another one we can pull from the |
Do we really need all the http attributes? In any case, as much as we have right now is okey and would be nice to continue to the complete client+server instrumentation. We can always add more attributes later, wdyt? |
1a81bd2
to
47f0d2e
Compare
public init() {} | ||
|
||
public func inject(_ value: String, forKey key: String, into headers: inout HPACKHeaders) { | ||
// TODO: Replace or add? |
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.
hmm good question though I guess replace here.
technically the same header could be added a few times (is that also true in h2, i dont remember?, but i think for our purposes it's a set()
named: String(requestInfo.uri.dropFirst()), | ||
context: context.baggage, | ||
ofKind: .client | ||
) |
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.
👍
47f0d2e
to
9bb4fe5
Compare
9bb4fe5
to
6590980
Compare
We won't adopt tracing out-of-the-box in v1, instead this will come in v2 via interceptors. |
This is a WIP for tracing gRPC services. It's meant as a playground for experimenting with how such instrumentation will look like.