Brave / Sleuth Support
This page focuses on the integration with brave / Spring Cloud Sleuth. This is an optional feature.
Table of Contents
Dependencies
grpc-spring-boot-starter provides automatic support for Brave Instrumentation: GRPC
.
However, there are two requirements:
- You need the dependencies for Brave on the classpath.
- You need a
Tracing
bean in your application context. If you have Spring Cloud Sleuth in your classpath, it will automatically configure this bean for you.
Brave
You can add the required dependencies for brave to Maven like this:
<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave-instrumentation-grpc</artifactId>
</dependency>
and to Gradle like this:
compile("io.zipkin.brave:brave-instrumentation-grpc")
Spring Cloud Sleuth
You can add sleuth to your application using Maven like this:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
and using Gradle like this:
compile("org.springframework.cloud:spring-cloud-starter-sleuth")
Please refer to the official documentation on how to set up/configure Sleuth.
Opt-Out
You can opt-out from the grpc-tracing using the following property:
spring.sleuth.grpc.enabled=false
Additional Notes
Spring-Cloud-Sleuth provides a few classes such as
SpringAwareManagedChannelBuilder
,
those classes solely exists for compatibility reasons with a different library. Do not use them with this library.
grpc-spring-boot-starter provides the same/extended functionality out of the box with the
GrpcChannelFactory
and related classes. See also
sleuth’s javadoc note.