This repository provides OpenTracing instrumentation for Spring Boot and its various extensions. It can be used with any OpenTracing compatible implementation.
It contains auto-configurations which instruments and trace following Spring Boot projects:
- Spring Web (RestControllers, RestTemplates, WebAsyncTask, WebClient, WebFlux)
- @Async, @Scheduled, Executors
- WebSocket STOMP
- Feign, HystrixFeign
- Hystrix
- JMS
- JDBC
- Mongo
- Zuul
- Reactor
- RxJava
- Redis
- Standard logging - logs are added to active span
- Spring Messaging - trace messages being sent through Messaging Channels
- RabbitMQ
The following table shows versions with compatible Spring Cloud releases.
opentracing-spring-cloud version | OpenTracing API | Spring Cloud version |
---|---|---|
0.4.x | 0.32.0 | Hoxton |
0.3.x | 0.32.0 | Greenwhich |
0.2.x | 0.31.0 | Finchley , Greenwhich |
0.1.x | 0.31.0 | Dalston , Edgware |
This project is similar to spring-cloud-sleuth,
both provide out of the box tracing solution for Spring Boot/Cloud. Some of the instrumentations in this
package are based on original sleuth
work.
However there are a couple of differences:
- OpenTracing support in
sleuth
is limited to only one tracer implementation - brave-opentracing. In other words it's not possible to use arbitrary OpenTracing tracer withsleuth
. sleuth
might support different set of instrumentations.- Instrumentations in
sleuth
might add different set of tags and logs to represent the same events.
It's worth noting that the although OpenTracing Spring Cloud contains code for instrumenting a wealth of Spring projects, it however does not pull those dependencies automatically, marking them as optional dependencies instead.
That means that for example a simple Spring Boot REST API application can include OpenTracing Spring Cloud without the fear of polluting the classpath with Spring Cloud dependencies that are otherwise unneeded
The preferred way to use this library is via vendored starters. These starters use instrumentations from this library and expose specific tracer configuration in Spring native way:
Just add the following dependency in your pom.xml:
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-cloud-starter</artifactId>
</dependency>
, and provide OpenTracing tracer bean:
@Bean
public io.opentracing.Tracer tracer() {
return new // tracer instance of your choice (Zipkin, Jaeger, LightStep)
}
Maven checkstyle plugin is used to maintain consistent code style based on Google Style Guides
./mvnw clean install
make // to run tests including dependency tests, a specific profile can be specified by make PROFILES=nodeps
Follow instructions in RELEASE