opentelemetry-java-examples
opentelemetry-java-examples copied to clipboard
Delete the gRPC example
Users should use gRPC library instrumentation and definitely not do manual instrumentation of gRPC. We do get confusion because of the example though.
https://github.com/open-telemetry/opentelemetry-java/issues/3610#issuecomment-918701670
IIRC, this isn't the first time - I don't think we should have this example since it's not an example of usage we would expect as we have the library instrumentation.
Do you have some ideas on what else we could provide for client/server examples? Or, is the http example enough?
Two thoughts:
- Where do we have examples for folks writing instrumentation?
- For folks who want library-based implementation, is there an example that uses gRPC we can have instead? All the examples in the instrumentation repository push towards the agent (or are for agent extensions)
All the examples in the instrumentation repository push towards the agent (or are for agent extensions)
Check out https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/standalone-library-instrumentation.md#standalone-library-instrumentation for library-based instrumentation.
Though only some of those have nice docs so far, e.g.
Im also curious. I have a grpc client and server and i want to instrument it. what example should i follow?
hi @mishra, there's no example currently, but the best way is to use https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTracing.java
@trask appreciate the quick reply but I'm completely new to this so, i'm feeling a bit lost. Any small examples on how to start this would be greatly appreciated.
@trask I'm looking to manually instrument my code as i dont want any extra overhead of running the java agent
the grpc library instrumentation linked above is not using the javaagent
I'm driving by, after an evening of hair loss trying to figure out why my kotlin grpc server doesn't propagate OT spans. This is probably the 10th bug report I've read, and I've read all the GrpcTracing code and all the related tests. I confess that even though supposedly I know quite a bit about this subject, I may have experienced knowledge and information sucked out of my brain through this process. I feel that I know less than when I started.
The only reference I've been able to find for this is here: https://github.com/pambrose/prometheus-proxy/blob/master/src/main/kotlin/io/prometheus/proxy/ProxyGrpcService.kt#L71 , but it is using a tracing library from Zipkin (brave.grpc.GrpcTracing
). My best current plan is to copy what that code does.
One quick question that's front of mind: should I expect agent-based instrumentation of a gRPC (using the stock io.grpc libraries) Kotlin application to "just work", or do I need to arrange to add an interceptor to my gRPC server to do span propagation? I think I read both forks in the multiverse above!
Actually I have an even more basic question: if I have the agent, but also call the library (e.g. use @withSpan
), is that expected to work? Or am I creating some split-brain frankentracing machine? I ask because I see many comments along the lines of "Ahh well if you were using the agent...". Ok, what if I'm using both?
For background, I got here after attempting to diagnose a problem in a very large multi-service, multi-language application that uses OT, but I discovered that spans aren't being propagated in various scenarios. I thought this one would be the easiest to fix...
Hope that all made some sense.