This project demonstrates how Spring Cloud Sleuth can be used to instrument gRPC calls.
The auto-configuration for instrumenting gRPC requires the following two libraries to be on the classpath:
- grpc-spring-boot-starter
- brave-instrumentation-grpc
- Edit src/main/resources/application.yml and uncomment the "sample.zipkin.enable=false"
- Import this maven project into your favorite IDE
- Run the spring boot application.
- In a browser "http://localhost:8080/hi/fred"
- 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.
- Edit "src/main/resources/application.yml" and comment out the "sample.zipkin.enable=false"
- Import this maven project into your favorite IDE (note, I have not setup m2e to automatically build the stubs from within Eclipse)
- Run the spring boot application.
- In a browser "http://localhost:8080/hi/fred"
- Check out the results in zipkin, if running locally http://localhost:9411
- This project is using a snapshot version of spring-cloud-sleuth-core that includes the gRPC auto-configuration. Once this has been included in an official release, this override can be removed.
- This sample hosts both the gRPC client and server, in a real environment these would be separate.
- This sample uses a maven plugin to generate GRPC stubs/skeletons.
- You may see initial compiler errors when importing into Eclipse. This can be corrected by highlighting the project and selecting "Maven->Update Project" which will trigger the stubs/skeletons to be correctly generated.