vmaleze / java-spring-cloud

Distributed tracing for Spring Cloud and Spring Boot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status Released Version

OpenTracing Spring Cloud

This repository provides OpenTracing instrumentation for Spring Cloud. It can be used with any OpenTracing compatible implementation.

It contains auto-configurations for Spring Boot which will instrument and trace several Spring Cloud and other integrations:

  • Spring Web (RestControllers, RestTemplates, WebAsyncTask)
  • @Async, @Scheduled, Executors
  • WebSocket STOMP
  • Feign, HystrixFeign
  • Hystrix
  • JMS
  • JDBC
  • Mongo
  • Zuul
  • RxJava
  • Standard logging - logs are added to active span
  • Spring Messaging - trace messages being sent through Messaging Channels

This library is compatible with Spring Cloud Camden.SR7, Dalston.SR3 and Edgware.RELEASE

Comparison to spring-cloud-sleuth

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 one tracer implementation - brave-opentracing. In other words it's not possible to use arbitrary OpenTracing tracer with sleuth.
  • sleuth might support different set of instrumentations.
  • Instrumentations in sleuth might add different set of tags and logs to represent the same events.

Note on dependencies

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

Configuration

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)
}

Using the Jaeger auto-configuration module

See the README.md file

Using the Zipkin auto-configuration module

See the README.md file

Development

Maven checkstyle plugin is used to maintain consistent code style based on Google Style Guides

Note on tests

A running docker daemon needs to be present on the system before running the tests

./mvnw clean install
make // to run tests including dependency tests, a specific profile can be specified by make PROFILES=nodeps

Release

Follow instructions in RELEASE

License

Apache 2.0 License.

About

Distributed tracing for Spring Cloud and Spring Boot

License:Apache License 2.0


Languages

Language:Java 98.0%Language:Shell 1.8%Language:Makefile 0.2%