├── .gitignore
├── eureka-service
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── EurekaServiceApplication.java
│ └── resources
│ │ └── bootstrap.properties
│ └── test
│ └── java
│ └── com
│ └── example
│ └── EurekaServiceApplicationTests.java
├── images
├── feign.png
├── template.png
├── zipkin-logo.jpg
├── zipkin-ui-and-resttemplate-detail.png
├── zipkin-ui-and-resttemplate.png
└── zipkin-ui.png
├── message-client
├── manifest.yml
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── MessageClientApplication.java
│ └── resources
│ │ ├── application-cloud.properties
│ │ └── application.properties
│ └── test
│ └── java
│ └── com
│ └── example
│ └── ZipkinClientApplicationTests.java
├── message-service
├── manifest.yml
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── MessageServiceApplication.java
│ └── resources
│ │ ├── application-cloud.properties
│ │ └── application.properties
│ └── test
│ └── java
│ └── com
│ └── example
│ └── ZipkinClientApplicationTests.java
├── pom.xml
├── sleuth-basic
├── mvnw
├── mvnw.cmd
├── pom.xml
├── sleuth-basic.iml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── DemoApplication.java
│ └── resources
│ │ └── application.properties
│ └── test
│ └── java
│ └── com
│ └── example
│ └── DemoApplicationTests.java
├── sleuth.md
├── tracing.iml
├── zipkin-query-service
├── manifest.yml
├── pom.xml
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── ZipkinQueryServiceApplication.java
│ │ └── resources
│ │ │ ├── application-cloud.properties
│ │ │ └── application.properties
│ └── test
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── ZipkinQueryApplicationTests.java
└── zipkin-query-service.iml
└── zipkin-web
├── lib
└── zipkin-web-all.jar
├── manifest.yml
└── zipkin-web.sh
/.gitignore:
--------------------------------------------------------------------------------
1 | ### Maven template
2 | target/
3 | pom.xml.tag
4 | pom.xml.releaseBackup
5 | pom.xml.versionsBackup
6 | pom.xml.next
7 | release.properties
8 | dependency-reduced-pom.xml
9 | buildNumber.properties
10 | .mvn/timing.properties
11 | ### JetBrains template
12 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
13 |
14 | *.iml
15 |
16 | ## Directory-based project format:
17 | .idea/
18 | # if you remove the above rule, at least ignore the following:
19 |
20 | # User-specific stuff:
21 | # .idea/workspace.xml
22 | # .idea/tasks.xml
23 | # .idea/dictionaries
24 |
25 | # Sensitive or high-churn files:
26 | # .idea/dataSources.ids
27 | # .idea/dataSources.xml
28 | # .idea/sqlDataSources.xml
29 | # .idea/dynamic.xml
30 | # .idea/uiDesigner.xml
31 |
32 | # Gradle:
33 | # .idea/gradle.xml
34 | # .idea/libraries
35 |
36 | # Mongo Explorer plugin:
37 | # .idea/mongoSettings.xml
38 |
39 | ## File-based project format:
40 | *.ipr
41 | *.iws
42 |
43 | ## Plugin-specific files:
44 |
45 | # IntelliJ
46 | /out/
47 |
48 | # mpeltonen/sbt-idea plugin
49 | .idea_modules/
50 |
51 | # JIRA plugin
52 | atlassian-ide-plugin.xml
53 |
54 | # Crashlytics plugin (for Android Studio and IntelliJ)
55 | com_crashlytics_export_strings.xml
56 | crashlytics.properties
57 | crashlytics-build.properties
58 |
59 | ### Eclipse template
60 | *.pydevproject
61 | .metadata
62 | .gradle
63 | bin/
64 | tmp/
65 | *.tmp
66 | *.bak
67 | *.swp
68 | *~.nib
69 | local.properties
70 | .settings/
71 | .loadpath
72 |
73 | # Eclipse Core
74 | .project
75 |
76 | # External tool builders
77 | .externalToolBuilders/
78 |
79 | # Locally stored "Eclipse launch configurations"
80 | *.launch
81 |
82 | # CDT-specific
83 | .cproject
84 |
85 | # JDT-specific (Eclipse Java Development Tools)
86 | .classpath
87 |
88 | # Java annotation processor (APT)
89 | .factorypath
90 |
91 | # PDT-specific
92 | .buildpath
93 |
94 | # sbteclipse plugin
95 | .target
96 |
97 | # TeXlipse plugin
98 | .texlipse
99 | ### Java template
100 | *.class
101 |
102 | # Mobile Tools for Java (J2ME)
103 | .mtj.tmp/
104 |
105 | # Package Files #
106 | *.jar
107 | *.war
108 | *.ear
109 |
110 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
111 | hs_err_pid*
112 |
113 | # Created by .ignore support plugin (hsz.mobi)
114 |
--------------------------------------------------------------------------------
/eureka-service/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 |
7 | io.spring
8 | tracing
9 | 1.0.0.BUILD-SNAPSHOT
10 |
11 | eureka-service
12 |
13 |
14 | org.springframework.cloud
15 | spring-cloud-starter-eureka-server
16 |
17 |
18 |
19 |
20 |
21 | org.springframework.boot
22 | spring-boot-maven-plugin
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/eureka-service/src/main/java/com/example/EurekaServiceApplication.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
6 |
7 | @EnableEurekaServer
8 | @SpringBootApplication
9 | public class EurekaServiceApplication {
10 |
11 | public static void main(String[] args) {
12 | SpringApplication.run(EurekaServiceApplication.class, args);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/eureka-service/src/main/resources/bootstrap.properties:
--------------------------------------------------------------------------------
1 | spring.cloud.config.uri=http://localhost:8888
2 | spring.application.name=eureka-service
3 |
4 | server.port=8761
5 | eureka.client.register-with-eureka=false
6 | eureka.client.fetch-registry=false
--------------------------------------------------------------------------------
/eureka-service/src/test/java/com/example/EurekaServiceApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.springframework.boot.test.SpringApplicationConfiguration;
6 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
7 |
8 | @RunWith(SpringJUnit4ClassRunner.class)
9 | @SpringApplicationConfiguration(classes = EurekaServiceApplication.class)
10 | public class EurekaServiceApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/images/feign.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshlong-attic/sleuth-blog/3c353ce8a610e0e1c734c7902432ab6d3a1babae/images/feign.png
--------------------------------------------------------------------------------
/images/template.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshlong-attic/sleuth-blog/3c353ce8a610e0e1c734c7902432ab6d3a1babae/images/template.png
--------------------------------------------------------------------------------
/images/zipkin-logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshlong-attic/sleuth-blog/3c353ce8a610e0e1c734c7902432ab6d3a1babae/images/zipkin-logo.jpg
--------------------------------------------------------------------------------
/images/zipkin-ui-and-resttemplate-detail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshlong-attic/sleuth-blog/3c353ce8a610e0e1c734c7902432ab6d3a1babae/images/zipkin-ui-and-resttemplate-detail.png
--------------------------------------------------------------------------------
/images/zipkin-ui-and-resttemplate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshlong-attic/sleuth-blog/3c353ce8a610e0e1c734c7902432ab6d3a1babae/images/zipkin-ui-and-resttemplate.png
--------------------------------------------------------------------------------
/images/zipkin-ui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshlong-attic/sleuth-blog/3c353ce8a610e0e1c734c7902432ab6d3a1babae/images/zipkin-ui.png
--------------------------------------------------------------------------------
/message-client/manifest.yml:
--------------------------------------------------------------------------------
1 | ---
2 | applications:
3 | - name: zipkin-client-a
4 | memory: 512M
5 | instances: 1
6 | host: zipkin-client-a-${random-word}
7 | path: target/zipkin-client-a.jar
8 | services:
9 | - cnj-rabbitmq
10 | - zipkin-client-b
11 | env:
12 | SPRING_PROFILES_ACTIVE: cloud
13 | DEBUG: "true"
14 |
--------------------------------------------------------------------------------
/message-client/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | io.spring
7 | tracing
8 | 1.0.0.BUILD-SNAPSHOT
9 |
10 | message-client
11 |
12 |
13 | org.springframework.cloud
14 | spring-cloud-starter-eureka
15 |
16 |
17 | org.springframework.cloud
18 | spring-cloud-starter-stream-rabbit
19 |
20 |
21 | org.springframework.boot
22 | spring-boot-starter-aop
23 |
24 |
25 | org.springframework.cloud
26 | spring-cloud-sleuth-stream
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-web
31 |
32 |
33 | org.springframework.cloud
34 | spring-cloud-starter-feign
35 |
36 |
37 |
38 |
39 |
40 | org.springframework.boot
41 | spring-boot-maven-plugin
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/message-client/src/main/java/com/example/MessageClientApplication.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.apache.commons.logging.Log;
4 | import org.apache.commons.logging.LogFactory;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.boot.SpringApplication;
7 | import org.springframework.boot.autoconfigure.SpringBootApplication;
8 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
9 | import org.springframework.cloud.netflix.feign.EnableFeignClients;
10 | import org.springframework.cloud.netflix.feign.FeignClient;
11 | import org.springframework.cloud.sleuth.Sampler;
12 | import org.springframework.cloud.stream.annotation.EnableBinding;
13 | import org.springframework.cloud.stream.messaging.Sink;
14 | import org.springframework.context.annotation.Bean;
15 | import org.springframework.context.annotation.EnableAspectJAutoProxy;
16 | import org.springframework.core.ParameterizedTypeReference;
17 | import org.springframework.http.HttpMethod;
18 | import org.springframework.http.MediaType;
19 | import org.springframework.http.ResponseEntity;
20 | import org.springframework.integration.annotation.*;
21 | import org.springframework.web.bind.annotation.RequestMapping;
22 | import org.springframework.web.bind.annotation.RequestMethod;
23 | import org.springframework.web.bind.annotation.RestController;
24 | import org.springframework.web.client.RestTemplate;
25 |
26 | import java.util.Map;
27 |
28 | @EnableDiscoveryClient
29 | @EnableFeignClients
30 | @EnableAspectJAutoProxy(proxyTargetClass = true)
31 | @EnableBinding(Sink.class)
32 | @IntegrationComponentScan
33 | @SpringBootApplication
34 | public class MessageClientApplication {
35 |
36 | /**
37 | * the service with which we're communicating
38 | */
39 | public static final String ZIPKIN_CLIENT_B = "message-service";
40 |
41 | @Bean
42 | Sampler sampler() {
43 | return span -> true;
44 | }
45 |
46 | public static void main(String[] args) {
47 | SpringApplication.run(MessageClientApplication.class, args);
48 | }
49 | }
50 |
51 | @MessageEndpoint
52 | class MessageProcessor {
53 |
54 | private Log log = LogFactory.getLog(getClass());
55 |
56 | @ServiceActivator(inputChannel = Sink.INPUT)
57 | public void onMessage(String msg) {
58 | this.log.info("received message: '" + msg + "'.");
59 | }
60 | }
61 |
62 | @FeignClient(serviceId = MessageClientApplication.ZIPKIN_CLIENT_B)
63 | interface RestMessageReader {
64 |
65 | @RequestMapping(
66 | method = RequestMethod.GET,
67 | value = "/",
68 | consumes = MediaType.APPLICATION_JSON_VALUE)
69 | Map readMessage();
70 | }
71 |
72 | @RestController
73 | @RequestMapping("/message")
74 | class MessageClientRestController {
75 |
76 | @Autowired
77 | private RestTemplate restTemplate;
78 |
79 | @Autowired
80 | private RestMessageReader restReader;
81 |
82 |
83 | @RequestMapping("/template")
84 | ResponseEntity