io.opentracing.contrib:opentracing-spring-cloud

OpenTracing instrumentation for Spring Cloud

License

License

GroupId

GroupId

io.opentracing.contrib
ArtifactId

ArtifactId

opentracing-spring-cloud
Last Version

Last Version

0.1.13
Release Date

Release Date

Type

Type

jar
Description

Description

OpenTracing instrumentation for Spring Cloud

Download opentracing-spring-cloud

How to add to project

<!-- https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-spring-cloud/ -->
<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-spring-cloud</artifactId>
    <version>0.1.13</version>
</dependency>
// https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-spring-cloud/
implementation 'io.opentracing.contrib:opentracing-spring-cloud:0.1.13'
// https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-spring-cloud/
implementation ("io.opentracing.contrib:opentracing-spring-cloud:0.1.13")
'io.opentracing.contrib:opentracing-spring-cloud:jar:0.1.13'
<dependency org="io.opentracing.contrib" name="opentracing-spring-cloud" rev="0.1.13">
  <artifact name="opentracing-spring-cloud" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.opentracing.contrib', module='opentracing-spring-cloud', version='0.1.13')
)
libraryDependencies += "io.opentracing.contrib" % "opentracing-spring-cloud" % "0.1.13"
[io.opentracing.contrib/opentracing-spring-cloud "0.1.13"]

Dependencies

compile (20)

Group / Artifact Type Version
org.springframework.boot : spring-boot-configuration-processor Optional jar
org.springframework.boot : spring-boot-starter-aop jar
io.opentracing.contrib : opentracing-concurrent jar 0.1.0
io.opentracing.contrib : opentracing-spring-web-autoconfigure jar 0.2.1
io.opentracing.contrib : opentracing-jdbc jar 0.0.6
io.opentracing.contrib : opentracing-rxjava-1 jar 0.0.7
io.opentracing.contrib : opentracing-spring-messaging-starter jar 0.0.5
io.opentracing.contrib : opentracing-mongo-driver jar 0.0.4
org.mongodb : mongodb-driver Optional jar
io.github.openfeign.opentracing : feign-hystrix-opentracing jar 0.1.0
org.springframework.cloud : spring-cloud-starter-feign Optional jar
org.springframework.cloud : spring-cloud-starter-hystrix Optional jar
org.springframework.boot : spring-boot-starter-web Optional jar
org.springframework.cloud : spring-cloud-starter-zuul Optional jar
org.springframework : spring-jms Optional jar
javax.jms : jms-api Optional jar 1.1-rev-1
io.opentracing.contrib : opentracing-jms-spring jar 0.0.5
io.opentracing.contrib : opentracing-jms-1 jar 0.0.5
io.opentracing.contrib : opentracing-jms-common jar 0.0.5
org.springframework.boot : spring-boot-starter-websocket Optional jar

test (16)

Group / Artifact Type Version
io.opentracing : opentracing-util test-jar 0.31.0
org.apache.activemq : artemis-server jar
org.apache.activemq : artemis-jms-client jar
org.springframework.boot : spring-boot-starter-artemis jar
org.apache.activemq : artemis-jms-server jar
org.springframework.boot : spring-boot-starter-data-jpa jar
org.springframework.boot : spring-boot-starter-data-rest jar
org.springframework.boot : spring-boot-starter-data-mongodb jar
de.flapdoodle.embed : de.flapdoodle.embed.mongo jar 2.0.3
cz.jirutka.spring : embedmongo-spring jar 1.3.1
com.h2database : h2 jar
org.springframework : spring-jdbc jar
io.opentracing : opentracing-mock jar 0.31.0
org.awaitility : awaitility jar 3.0.0
org.springframework.boot : spring-boot-starter-test jar
io.github.openfeign : feign-okhttp jar 9.5.0

Project Modules

There are no modules declared in this project.

Build Status Released Version

OpenTracing Spring Cloud

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
  • Kafka
  • Mongo
  • Zuul
  • Reactor
  • RxJava
  • Redis
  • Standard logging - logs are added to active span
  • Spring Messaging - trace messages being sent through Messaging Channels
  • RabbitMQ

Compatibility table

The following table shows versions with compatible Spring Cloud releases.

opentracing-spring-cloud version OpenTracing API Spring Cloud version
0.5.x 0.33.0 Hoxton
0.4.x 0.32.0 Hoxton
0.3.x 0.32.0 Greenwich
0.2.x 0.31.0 Finchley, Greenwich
0.1.x 0.31.0 Dalston, Edgware

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 only 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

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:

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

Properties

Property Default Description
opentracing.spring.cloud.reactor.enabled true Enable Reactor tracing.
opentracing.spring.cloud.async.enabled true Enable tracing for @Async, Executor and WebAsyncTask/Callable.
opentracing.spring.cloud.log.enabled true Add standard logging output to tracing system.
opentracing.spring.cloud.scheduled.enabled true Enable @Scheduled tracing.
opentracing.spring.cloud.feign.enabled true Enable Feign tracing.
opentracing.spring.cloud.gateway.enabled true Enable Gateway tracing.
opentracing.spring.cloud.hystrix.strategy.enabled true Enable Propagation of spans across threads using in Hystrix command tracing.
opentracing.spring.cloud.jdbc.enabled true Enable JDBC tracing.
opentracing.spring.cloud.jms.enabled true Enable JMS tracing.
opentracing.spring.cloud.kafka.enabled true Enable Kafka tracing.
opentracing.spring.cloud.mongo.enabled true Enable MongoDB tracing.
opentracing.spring.cloud.reactor.enabled true Enable Reactor tracing.
opentracing.spring.cloud.rxjava.enabled true Enable RxJava tracing.
opentracing.spring.cloud.websocket.enabled true Enable Websocket tracing.
opentracing.spring.cloud.zuul.enabled true Enable Zuul tracing.
opentracing.spring.cloud.redis.enabled true Enable Redis tracing.
opentracing.spring.cloud.redis.prefixOperationName "" Set a prefix for each Redis operation, e.g: MyPrefix.SET.
opentracing.spring.cloud.jdbc.withActiveSpanOnly false Only trace JDBC calls if they are part of an active Span.
opentracing.spring.cloud.jdbc.ignoreStatements null Set of JDBC statements to not trace.

Development

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

Release

Follow instructions in RELEASE

License

Apache 2.0 License.

io.opentracing.contrib

3rd-Party OpenTracing API Contributions

3rd-party contributions that use OpenTracing. **The repositories in this org are *not* affiliated with the CNCF.**

Versions

Version
0.1.13
0.1.12
0.1.11
0.1.10
0.1.9
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.1
0.1.0
0.0.7
0.0.6
0.0.5
0.0.4
0.0.2
0.0.1