opencensus-java icon indicating copy to clipboard operation
opencensus-java copied to clipboard

Support for OpenCensus with Spring Sleuth

Open gkohen opened this issue 6 years ago • 9 comments

Please answer these questions before submitting a bug report.

What version of OpenCensus are you using?

0.12.2

What JVM are you using (java -version)?

JDK 8

What did you do?

Trying to use Spring Sleuth tracing library with Open Censsus

What did you expect to see?

This feature does not exist yet and hoped it can be included in the project timeline as Spring seems to be Java's most prominent framework at the moment.

What did you see instead?

N/A Our end goal is the hook up Spring Boot app with minimal effort to result in auto span creation for both HTTP and gRPC calls.

See: https://cloud.spring.io/spring-cloud-sleuth/

gkohen avatar Mar 27 '18 23:03 gkohen

@adriancole has been doing some work related to this.

bogdandrutu avatar Mar 28 '18 07:03 bogdandrutu

sleuth is in the middle of a big release around spring boot 2 (finchley)

https://github.com/spring-cloud/spring-cloud-release/milestones

We can't distract from that right now, but we do plan to look more into it afterwards. I made initial notes here, as under the covers sleuth 2 uses Brave (as opposed to the custom api it used to use)

https://github.com/openzipkin/brave/issues/626

codefromthecrypt avatar Mar 28 '18 10:03 codefromthecrypt

@adriancole understood that the dependencies are a in bit of in flux. In the time being is there a code snippet/recipe you can point folks to to create auto-spans for HTTP/gRPC calls in Java apps?

gkohen avatar Mar 28 '18 10:03 gkohen

right now, brave's instrumentation for grpc can be used in sleuth. It will only read when B3 headers are used (which is not the default for census+grpc yet) https://github.com/openzipkin/brave/tree/master/instrumentation/grpc

codefromthecrypt avatar Mar 28 '18 10:03 codefromthecrypt

Do you know where we can find a sample of how to instrument "auto" spans in our Java microservices. Are you suggesting that OpenCensus implement something like TracingServerInterceptor.java in Brave's code?

gkohen avatar Mar 28 '18 11:03 gkohen

no I just was trying to answer your question. https://github.com/spring-cloud/spring-cloud-sleuth/issues/305 is the issue originally tracking sleuth and grpc. It was closed once brave was added; people already trace heterogeneously using this approach. That doesn't mean it couldn't be more automatic, commenting on that issue could result in it being more automatic.

With regards to what census is doing, the grpc layer is obviously done, and work is being made to allow native instrumentation for things like http libraries and such. That will continue, but it isn't as progressed as sleuth. The idea is to integrate so that instrumentation doesn't have to all be duplicated. That isn't going to happen right now now because the sleuth team are busy with various things.

Hope to have answered somewhat. Feel free to join the gitter channel if not https://gitter.im/census-instrumentation/Lobby

codefromthecrypt avatar Mar 28 '18 12:03 codefromthecrypt

/cc @dinooliva

bogdandrutu avatar Aug 03 '18 11:08 bogdandrutu

hi, is there an opencensus Spring boot example i can look at . TIA

mukaramkhaleel avatar Sep 27 '18 07:09 mukaramkhaleel

Might be related: https://github.com/yidongnan/grpc-spring-boot-starter/issues/236

ST-DDT avatar Jun 04 '19 15:06 ST-DDT