Skip to content

Commit 808572d

Browse files
authored
Deprecates all span transports except spring-cloud-sleuth-zipkin2 (#758)
This deprecates span transports in favor of `spring-cloud-sleuth-zipkin2` which: * Supports RabbitMQ and Kafka automatically when adding spring-rabbit or spring-kafka deps * Supports any io.zipkin.reporter2:zipkin-reporter sender, including Amazon X-Ray * Defaults to zipkin v2 format, but can be configured to use zipkin v1 format as needed This lowers the amount of maintenance on the project, as discussed in various issues See #727 See #711
1 parent bf6c543 commit 808572d

File tree

27 files changed

+42
-799
lines changed

27 files changed

+42
-799
lines changed

Diff for: docs/src/main/asciidoc/features.adoc

+5-7
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,17 @@ a baggage element then it will be sent downstream either via HTTP or messaging t
4141
4242
* Provides simple metrics of accepted / dropped spans.
4343
44-
* If `spring-cloud-sleuth-zipkin` then the app will generate and collect Zipkin-compatible traces.
44+
* If `spring-cloud-sleuth-zipkin2` then the app will generate and collect Zipkin-compatible traces.
4545
By default it sends them via HTTP to a Zipkin server on localhost (port 9411).
4646
Configure the location of the service using `spring.zipkin.baseUrl`.
47+
- If you depend on `spring-rabbit` or `spring-kafka` your app will send traces to a broker instead of http.
48+
- Note: `spring-cloud-sleuth-stream` is deprecated and should no longer be used.
4749
48-
* If `spring-cloud-sleuth-stream` then the app will generate and collect traces via https://github.com/spring-cloud/spring-cloud-stream[Spring Cloud Stream].
49-
Your app automatically becomes a producer of tracer messages that are sent over your broker of choice
50-
(e.g. RabbitMQ, Apache Kafka, Redis).
51-
52-
IMPORTANT: If using Zipkin or Stream, configure the percentage of spans exported using `spring.sleuth.sampler.percentage`
50+
IMPORTANT: If using Zipkin, configure the percentage of spans exported using `spring.sleuth.sampler.percentage`
5351
(default 0.1, i.e. 10%). *Otherwise you might think that Sleuth is not working cause it's omitting some spans.*
5452

5553
NOTE: the SLF4J MDC is always set and logback users will immediately see the trace and span ids in logs per the example
5654
above. Other logging systems have to configure their own formatter to get the same result. The default is
5755
`logging.pattern.level` set to `%5p [${spring.zipkin.service.name:${spring.application.name:-}},%X{X-B3-TraceId:-},%X{X-B3-SpanId:-},%X{X-Span-Export:-}]`
5856
(this is a Spring Boot feature for logback users).
59-
*This means that if you're not using SLF4J this pattern WILL NOT be automatically applied*.
57+
*This means that if you're not using SLF4J this pattern WILL NOT be automatically applied*.

Diff for: docs/src/main/asciidoc/intro.adoc

+21-93
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ the Spring BOM
280280

281281
==== Sleuth with Zipkin via HTTP
282282

283-
If you want both Sleuth and Zipkin just add the `spring-cloud-starter-zipkin` dependency.
283+
If you want both Sleuth and Zipkin just add the `spring-cloud-starter-zipkin2` dependency.
284284

285285
[source,xml,indent=0,subs="verbatim,attributes",role="primary"]
286286
.Maven
@@ -299,12 +299,12 @@ If you want both Sleuth and Zipkin just add the `spring-cloud-starter-zipkin` de
299299
300300
<dependency> <2>
301301
<groupId>org.springframework.cloud</groupId>
302-
<artifactId>spring-cloud-starter-zipkin</artifactId>
302+
<artifactId>spring-cloud-starter-zipkin2</artifactId>
303303
</dependency>
304304
----
305305
<1> In order not to pick versions by yourself it's much better if you add the dependency management via
306306
the Spring BOM
307-
<2> Add the dependency to `spring-cloud-starter-zipkin`
307+
<2> Add the dependency to `spring-cloud-starter-zipkin2`
308308

309309
[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
310310
.Gradle
@@ -316,78 +316,22 @@ dependencyManagement { <1>
316316
}
317317
318318
dependencies { <2>
319-
compile "org.springframework.cloud:spring-cloud-starter-zipkin"
319+
compile "org.springframework.cloud:spring-cloud-starter-zipkin2"
320320
}
321321
----
322322
<1> In order not to pick versions by yourself it's much better if you add the dependency management via
323323
the Spring BOM
324-
<2> Add the dependency to `spring-cloud-starter-zipkin`
324+
<2> Add the dependency to `spring-cloud-starter-zipkin2`
325325

326-
==== Sleuth with Zipkin via Spring Cloud Stream
326+
==== Sleuth with Zipkin via RabbitMQ or Kafka
327327

328-
If you want both Sleuth and Zipkin just add the `spring-cloud-sleuth-stream` dependency.
328+
If you want to use RabbitMQ or Kafka instead of http, add the `spring-rabbit` or `spring-kafka`
329+
dependencies. The default destination name is `zipkin`.
329330

330-
[source,xml,indent=0,subs="verbatim,attributes",role="primary"]
331-
.Maven
332-
----
333-
<dependencyManagement> <1>
334-
<dependencies>
335-
<dependency>
336-
<groupId>org.springframework.cloud</groupId>
337-
<artifactId>spring-cloud-dependencies</artifactId>
338-
<version>${release.train.version}</version>
339-
<type>pom</type>
340-
<scope>import</scope>
341-
</dependency>
342-
</dependencies>
343-
</dependencyManagement>
344-
345-
<dependency> <2>
346-
<groupId>org.springframework.cloud</groupId>
347-
<artifactId>spring-cloud-sleuth-stream</artifactId>
348-
</dependency>
349-
<dependency> <3>
350-
<groupId>org.springframework.cloud</groupId>
351-
<artifactId>spring-cloud-starter-sleuth</artifactId>
352-
</dependency>
353-
<!-- EXAMPLE FOR RABBIT BINDING -->
354-
<dependency> <4>
355-
<groupId>org.springframework.cloud</groupId>
356-
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
357-
</dependency>
358-
----
359-
<1> In order not to pick versions by yourself it's much better if you add the dependency management via
360-
the Spring BOM
361-
<2> Add the dependency to `spring-cloud-sleuth-stream`
362-
<3> Add the dependency to `spring-cloud-starter-sleuth` - that way all dependant dependencies will be downloaded
363-
<4> Add a binder (e.g. Rabbit binder) to tell Spring Cloud Stream what it should bind to
364-
365-
[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
366-
.Gradle
367-
----
368-
dependencyManagement { <1>
369-
imports {
370-
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${releaseTrainVersion}"
371-
}
372-
}
373-
374-
dependencies {
375-
compile "org.springframework.cloud:spring-cloud-sleuth-stream" <2>
376-
compile "org.springframework.cloud:spring-cloud-starter-sleuth" <3>
377-
// Example for Rabbit binding
378-
compile "org.springframework.cloud:spring-cloud-stream-binder-rabbit" <4>
379-
}
380-
----
381-
<1> In order not to pick versions by yourself it's much better if you add the dependency management via
382-
the Spring BOM
383-
<2> Add the dependency to `spring-cloud-sleuth-stream`
384-
<3> Add the dependency to `spring-cloud-starter-sleuth` - that way all dependant dependencies will be downloaded
385-
<4> Add a binder (e.g. Rabbit binder) to tell Spring Cloud Stream what it should bind to
386-
387-
==== Spring Cloud Sleuth Stream Zipkin Collector
331+
_Note: `spring-cloud-sleuth-stream` is deprecated and incompatible with these destinations_
388332

389-
If you want to start a Spring Cloud Sleuth Stream Zipkin collector just add the `spring-cloud-sleuth-zipkin-stream`
390-
dependency
333+
If you want Sleuth over RabbitMQ add the `spring-cloud-sleuth-starter-zipkin2` and `spring-rabbit`
334+
dependencies.
391335

392336
[source,xml,indent=0,subs="verbatim,attributes",role="primary"]
393337
.Maven
@@ -406,23 +350,17 @@ dependency
406350
407351
<dependency> <2>
408352
<groupId>org.springframework.cloud</groupId>
409-
<artifactId>spring-cloud-sleuth-zipkin-stream</artifactId>
353+
<artifactId>spring-cloud-sleuth-starter-zipkin2</artifactId>
410354
</dependency>
411355
<dependency> <3>
412-
<groupId>org.springframework.cloud</groupId>
413-
<artifactId>spring-cloud-starter-sleuth</artifactId>
414-
</dependency>
415-
<!-- EXAMPLE FOR RABBIT BINDING -->
416-
<dependency> <4>
417-
<groupId>org.springframework.cloud</groupId>
418-
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
356+
<groupId>org.springframework.amqp</groupId>
357+
<artifactId>spring-rabbit</artifactId>
419358
</dependency>
420359
----
421360
<1> In order not to pick versions by yourself it's much better if you add the dependency management via
422361
the Spring BOM
423-
<2> Add the dependency to `spring-cloud-sleuth-zipkin-stream`
424-
<3> Add the dependency to `spring-cloud-starter-sleuth` - that way all dependant dependencies will be downloaded
425-
<4> Add a binder (e.g. Rabbit binder) to tell Spring Cloud Stream what it should bind to
362+
<2> Add the dependency to `spring-cloud-starter-sleuth-zipkin2` - that way all dependent dependencies will be downloaded
363+
<3> To automatically configure rabbit, simply add the spring-rabbit dependency
426364

427365
[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
428366
.Gradle
@@ -434,29 +372,19 @@ dependencyManagement { <1>
434372
}
435373
436374
dependencies {
437-
compile "org.springframework.cloud:spring-cloud-sleuth-zipkin-stream" <2>
438-
compile "org.springframework.cloud:spring-cloud-starter-sleuth" <3>
439-
// Example for Rabbit binding
440-
compile "org.springframework.cloud:spring-cloud-stream-binder-rabbit" <4>
375+
compile "org.springframework.cloud:spring-cloud-starter-sleuth-zipkin2" <2>
376+
compile "org.springframework.amqp:spring-rabbit" <3>
441377
}
442378
----
443379
<1> In order not to pick versions by yourself it's much better if you add the dependency management via
444380
the Spring BOM
445-
<2> Add the dependency to `spring-cloud-sleuth-zipkin-stream`
446-
<3> Add the dependency to `spring-cloud-starter-sleuth` - that way all dependant dependencies will be downloaded
447-
<4> Add a binder (e.g. Rabbit binder) to tell Spring Cloud Stream what it should bind to
448-
449-
and then just annotate your main class with `@EnableZipkinStreamServer` annotation:
450-
451-
[source,java]
452-
----
453-
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-sleuth/master/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin-stream/src/main/java/example/ZipkinStreamServerApplication.java[]
454-
----
381+
<2> Add the dependency to `spring-cloud-starter-sleuth-zipkin2` - that way all dependent dependencies will be downloaded
382+
<3> To automatically configure rabbit, simply add the spring-rabbit dependency
455383

456384
== Additional resources
457385

458386
*Marcin Grzejszczak talking about Spring Cloud Sleuth and Zipkin*
459387

460388
video::eQV71Mw1u1c[youtube]
461389

462-
https://www.youtube.com/watch?v=eQV71Mw1u1c[click here to see the video]
390+
https://www.youtube.com/watch?v=eQV71Mw1u1c[click here to see the video]

Diff for: spring-cloud-sleuth-samples/README.adoc

+2-19
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ There are a few samples with slightly different features. You can run all of the
66

77
* `spring-cloud-sleuth-sample`: vanilla (no zipkin) web app that calls back to itself on various endpoints ("/", "/call", "/async")
88

9-
* `spring-cloud-sleuth-sample-zipkin`: same as vanilla sample but with zipkin (set `sample.zipkin.enabled=true` if you have a collector running)
10-
11-
* `spring-cloud-sleuth-sample-stream`: same as vanilla sample, but exports span data to RabbitMQ using Spring Cloud Stream
12-
13-
* `spring-cloud-sleuth-sample-stream-zipkin`: a consumer for the span data on RabbitMQ that pushes it into a Zipkin span store, so it can be queried and visualized using the embedded Zipkin UI.
9+
* `spring-cloud-sleuth-sample-zipkin2`: same as vanilla sample but with zipkin (set `sample.zipkin.enabled=true` if you have a collector running)
1410

1511
* `spring-cloud-sleuth-sample-messaging`: a Spring Integration application with two HTTP endpoints ("/" and "/xform")
1612

@@ -20,7 +16,7 @@ The Ribbon sample makes an interesting demo or playground for learning about zip
2016

2117
=== Running samples with Zipkin
2218

23-
1. Optionally run the https://github.com/openzipkin/zipkin[Zipkin] Server, e.g. via docker compose (there's a `docker-compose.yml` in https://github.com/spring-cloud/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin[Spring Cloud Sleuth], or in https://github.com/openzipkin/docker-zipkin[Docker Zipkin]
19+
1. Optionally run the https://github.com/openzipkin/zipkin[Zipkin] Server, e.g. via docker compose (there's a `docker-compose.yml` in https://github.com/spring-cloud/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin2[Spring Cloud Sleuth], or in https://github.com/openzipkin/docker-zipkin[Docker Zipkin]
2420
7. Run the zipkin sample application (set `sample.zipkin.enabled=false` if you have no Zipkin running). If you are using a VM to run docker you might need to tunnel port 9411 to localhost, or change the `spring.zipkin.baseUrl`.
2521
8. Hit `http://localhost:3380`, `http://localhost:3380/call`, `http://localhost:3380/async` for some interesting sample traces (the app callas back to itself).
2622
9. Go to `http://localhost:9411` for Zipkin's UI (if you are using boot2docker the host will be different)
@@ -30,16 +26,3 @@ NOTE: You can see the zipkin spans without the UI (in logs) if you run the sampl
3026
image::{github-raw}/docs/src/main/asciidoc/images/zipkin-trace-screenshot.png[Sample Zipkin Screenshot]
3127

3228
> The fact that the first trace in says "testSleuthMessaging" seems to be a bug in the UI (it has some annotations from that service, but it originates in the "testSleuthRibbon" service).
33-
34-
=== Running samples with Zipkin Stream
35-
36-
Instead of POSTing trace data directly to a Zipkin server, you can export them over https://raw.githubusercontent.com/spring-cloud/spring-cloud-stream[Spring Cloud Stream].
37-
38-
1. Run the RabbitMQ middleware for Zipkin (you can use `docker-compose.yml`).
39-
2. Build the Zipkin Stream sample with Maven and run it.
40-
7. Run the `spring-cloud-sleuth-sample-stream` app and interact with it in a browser, just like the vanilla sample. If you are using a VM to run docker you might need to tunnel port 5672 to localhost, or change the `spring.rabbbitmq.host`.
41-
9. Go to `http://localhost:9411` for Zipkin's UI
42-
43-
The UI should look more or less like this:
44-
45-
image::{github-raw}/docs/src/main/asciidoc/images/zipkin-traces.png[Zipkin Web Screenshot]

Diff for: spring-cloud-sleuth-samples/pom.xml

-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
<module>spring-cloud-sleuth-sample-feign</module>
2525
<module>spring-cloud-sleuth-sample-ribbon</module>
2626
<module>spring-cloud-sleuth-sample-zipkin2</module>
27-
<module>spring-cloud-sleuth-sample-stream</module>
28-
<module>spring-cloud-sleuth-sample-zipkin-stream</module>
2927
</modules>
3028

3129
<build>

Diff for: spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-stream/pom.xml

-94
This file was deleted.

Diff for: spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-stream/src/main/java/sample/SampleBackground.java

-43
This file was deleted.

0 commit comments

Comments
 (0)