Skip to content
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

First attempt to add GRPC instrumentation #1139

Merged
merged 2 commits into from
Dec 4, 2018

Conversation

tkvangorder
Copy link
Contributor

No description provided.

@pivotal-issuemaster
Copy link

@tkvangorder Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-issuemaster
Copy link

@tkvangorder Thank you for signing the Contributor License Agreement!

@tkvangorder
Copy link
Contributor Author

@marcingrzejszczak Here is the first stab at GRPC support. Things that make this strange:

  • Guava 20.0 is used in the latest GRPC code and I had to force sleuth to use that version. I am sure you have run into this before, I am not a fan of having to do this, any ideas?
  • The auto-configuration relies on functionality provided by grpc-spring-boot-starter. This is an external, third-party library.
  • There is a sample included, it needs to generate stubs/skeletons as part of the maven build.

Copy link
Contributor

@codefromthecrypt codefromthecrypt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of this code is sample related and I'd suggest making a branch similar to dubbo example here instead. that leaves the code in this project concise to the point of sleuth, not the full operations of more demos.

https://github.com/openzipkin/sleuth-webmvc-example

@@ -32,6 +32,11 @@
</parent>

<dependencies>
<dependency>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this can be a mandatory dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, after thinking about this, I can make this a test scope dependency, as it is during the tests that the failures manifest. Still not a great solution, but I am not sure what else would make more sense?


## Running with Zipkin:

1. For conveinence, there is a docker-compose file in the project that can be used to launch zipkin locally. Otherwise, you will need to run zipkin separately.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo

Suggested change
1. For conveinence, there is a docker-compose file in the project that can be used to launch zipkin locally. Otherwise, you will need to run zipkin separately.
1. For convenience, there is a docker-compose file in the project that can be used to launch zipkin locally. Otherwise, you will need to run zipkin separately.

version: '2'

services:
storage:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mysql is unnecessary for this.. just use default in-mem.. probably docker-compose itself is overkill

See also https://github.com/openzipkin/sleuth-webmvc-example

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will clean that up as well, thanks.

@tkvangorder
Copy link
Contributor Author

tkvangorder commented Nov 20, 2018

@adriancole Thanks for the quick turn-around, I will move the sample out of the core project. Calling it a night, I will get this done tomorrow.

@codefromthecrypt
Copy link
Contributor

codefromthecrypt commented Nov 20, 2018 via email

@codecov-io
Copy link

codecov-io commented Nov 20, 2018

Codecov Report

Merging #1139 into master will increase coverage by 0.34%.
The diff coverage is 89.28%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1139      +/-   ##
============================================
+ Coverage     69.34%   69.69%   +0.34%     
- Complexity      709      723      +14     
============================================
  Files           129      132       +3     
  Lines          3321     3349      +28     
  Branches        360      363       +3     
============================================
+ Hits           2303     2334      +31     
+ Misses          816      809       -7     
- Partials        202      206       +4
Impacted Files Coverage Δ Complexity Δ
...th/instrument/grpc/TraceGrpcAutoConfiguration.java 100% <100%> (ø) 5 <5> (?)
...t/grpc/TracingManagedChannelBuilderCustomizer.java 100% <100%> (ø) 2 <2> (?)
...trument/grpc/SpringAwareManagedChannelBuilder.java 83.33% <83.33%> (ø) 7 <7> (?)
...ing/TracingConnectionFactoryBeanPostProcessor.java 73.21% <0%> (+5.35%) 6% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3a618e6...fb91f8f. Read the comment docs.

@tkvangorder
Copy link
Contributor Author

@tkvangorder
Copy link
Contributor Author

@adriancole @marcingrzejszczak I did a little refactoring and added some documentation around the implementation details. How do you both feel about the dependency on grpc-spring-boot-starter? This can work for now but it feels like it would be better if there were a spring-sanctioned gRPC project: spring-grpc or spring-cloud-grpc?

@devinsba
Copy link
Contributor

A gRPC sanctioned Spring-Boot starter would also be awesome: https://github.com/grpc-ecosystem could be a good home. I know there are other starters hanging around so it would be good to have a community maintained one that gRPC is willing to put their name on

@spencergibb
Copy link
Member

@tkvangorder
Copy link
Contributor Author

I think after Google open sourced gRPC they handed things over to the community, so I am not sure if it makes sense to put it under the GCP umbrella? I am a relative newbie to gRPC, so take my opinion with a grain of salt.

Regardless of home, having an agreed upon home for Spring + gRPC would be great. In addition to https://github.com/LogNet/grpc-spring-boot-starter, there is also an interesting reactive effort https://github.com/salesforce/reactive-grpc

@spencergibb
Copy link
Member

From what I recall, the boot team prefers the starter to be external until there is some Framework integration (which there isn't, but there is a jira issue).

@marcingrzejszczak marcingrzejszczak added this to the 2.1.0.RC1 milestone Dec 4, 2018
@marcingrzejszczak marcingrzejszczak merged commit 415a7a6 into spring-cloud:master Dec 4, 2018
@marcingrzejszczak
Copy link
Contributor

I'm merging what we have here ATM and we can think of changing the starter to sth else if necessary.

@yishibai02
Copy link

Another repo has done this.
https://github.com/yidongnan/grpc-spring-boot-starter
This repo seems to provide a lot of features.

@tkvangorder
Copy link
Contributor Author

@yishibai02 This PR relies on grpc-spring-boot-starter being on the classpath and will add tracing interceptors to the servers (by introducing a brave's server tracing interceptor) and to clients (by introducing a spring-aware ManagedChannelBuilder and brave's client tracing interceptor)

@yishibai02
Copy link

I see this repo also supports Spring Sleuth to trace application.
GrpcServerAutoConfiguration.java#L147-L159
GrpcClientAutoConfiguration.java#L158-L170

I think these commit be better placed in the third-party starter repo.

@tkvangorder
Copy link
Contributor Author

@yishibai02. Thanks for the clarification!

The repo's have the same name but are very different in the implementation details.

For now, this PR introduces auto-configuration only when the LogNet/grpc-spring-boot-starter is on the classpath.

There is still work to be done to introduce an "official" project for using grpc with spring/spring boot. Perhaps yidongnan/grpc-spring-boot-starter might be a good place to start as a contribution towards that goal?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants