Intended way to interact with openetelemetry-grpc #8502
Replies: 2 comments 2 replies
-
There is some sample code for setting up the grpc library instrumentation in https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/grpc-1.6/library/README.md You can also examine the tests on how they use the library https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTest.java |
Beta Was this translation helpful? Give feedback.
-
That readme only concerns how to setup the interceptors (and does a great job of telling you how to, actually), which I'm confident I've done correctly. I suppose that there's no documentation on how to interact with the span is probably a bit telling that maybe one's not supposed to? That test isn't helpful, for similar reasons. The place I want to obtain the span would be this line I do sort of feel I might have found a bug, but even if I have, it's a bug in an undocumented usecase - and also I can't reliably reproduce it so I don't think I can raise such a bug. If there is no intended way to interact with the span I think I might just replace the instrumentation with my own code and put the spans into the grpc requests so that they can be explicitly handled. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I'm using the openetelemetry-grpc instrumentation. I set up interceptors for my clients and servers. All my other traces are manually instrumented, and I avoid using context (by which I mean, the thread local variable) anywhere because I prefer to manually pass things around (mostly because I find it easier to reason about).
I'm having an issue though, the way I've interacted with the interceptor is, when I make my client call, I briefly set the context using my current span, and promptly close the scope. On the server side, in my grpc server code, I call Span.current() in the method that is supposed to handle the request,
it looks basically like so (this is scala but that shouldn't matter much)
And my intent is basically to pick up the context that the serverInterceptor sets.
This normally all works super, for several thousand requests. At some point though, it just stops working, and the span starts coming through as Span.getInvalid. In my traces, the traces terminate at the traces inside the server interceptor. I see the SENT and RECEIVED events, https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/TracingServerInterceptor.java#L129. Once it stops working, it stops working everywhere and doesn't recover until I restart the application.
All this makes me think, what actually is the intended way to interact with opentelemetry-grpc? I just sort of made this approach up I'm using because it seemed logical, but maybe I'm doing something fundamentally wrong.
Beta Was this translation helpful? Give feedback.
All reactions