census-instrumentation / opencensus-java

A stats collection and distributed tracing framework
https://opencensus.io
Apache License 2.0
674 stars 201 forks source link

Support for OpenCensus with Spring Sleuth #1104

Open gkohen opened 6 years ago

gkohen commented 6 years ago

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/

bogdandrutu commented 6 years ago

@adriancole has been doing some work related to this.

codefromthecrypt commented 6 years ago

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

gkohen commented 6 years ago

@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?

codefromthecrypt commented 6 years ago

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

gkohen commented 6 years ago

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?

codefromthecrypt commented 6 years ago

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

bogdandrutu commented 6 years ago

/cc @dinooliva

mukaramkhaleel commented 5 years ago

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

ST-DDT commented 5 years ago

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