Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Distributed tracing for Spring Boot, Cloud and other Spring projects

License

NotificationsYou must be signed in to change notification settings

opentracing-contrib/java-spring-cloud

Repository files navigation

Build StatusReleased Version

OpenTracing Spring Cloud

This repository provides OpenTracing instrumentation for Spring Boot and its various extensions. It can be used with any OpenTracingcompatible 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 throughMessaging Channels
  • RabbitMQ

Compatibility table

The following table shows versions with compatibleSpring Cloud releases.

opentracing-spring-cloud versionOpenTracing APISpring Cloud version
0.5.x0.33.0Hoxton
0.4.x0.32.0Hoxton
0.3.x0.32.0Greenwich
0.2.x0.31.0Finchley,Greenwich
0.1.x0.31.0Dalston,Edgware

Comparison tospring-cloud-sleuth

This project is similar tospring-cloud-sleuth,both provide out of the box tracing solution for Spring Boot/Cloud. Some of the instrumentations in thispackage are based on originalsleuth work.

However there are a couple of differences:

  • OpenTracing support insleuth 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 insleuth 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 fearof 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 useinstrumentations from this library and expose specific tracer configuration in Springnative 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:

@Beanpublicio.opentracing.Tracertracer() {returnnew// tracer instance of your choice (Zipkin, Jaeger, LightStep)}

Properties

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

Development

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

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

Release

Follow instructions inRELEASE

License

Apache 2.0 License.


[8]ページ先頭

©2009-2025 Movatter.jp