Skip to content

Commit 0f63c6e

Browse files
committedAug 11, 2017
update sleuth
1 parent 45e2677 commit 0f63c6e

File tree

22 files changed

+171
-437
lines changed

22 files changed

+171
-437
lines changed
 

‎ms-sleuth-service1/pom.xml

+4-11
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,10 @@
2525
</properties>
2626

2727
<dependencies>
28-
<dependency>
29-
<groupId>org.springframework.cloud</groupId>
30-
<artifactId>spring-cloud-starter-zipkin</artifactId>
31-
</dependency>
32-
33-
<dependency>
34-
<groupId>org.springframework.cloud</groupId>
35-
<artifactId>spring-cloud-starter-zipkin</artifactId>
36-
</dependency>
37-
38-
28+
<dependency>
29+
<groupId>org.springframework.cloud</groupId>
30+
<artifactId>spring-cloud-starter-sleuth</artifactId>
31+
</dependency>
3932

4033
<dependency>
4134
<groupId>org.springframework.boot</groupId>
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
spring:
22
application:
33
name: sleuth-ervice1
4-
sleuth:
5-
sampler:
6-
percentage: 1.0
7-
zipkin:
8-
base-url: http://localhost:9411/
4+
# sleuth:
5+
# sampler:
6+
# percentage: 1.0
7+
# zipkin:
8+
# base-url: http://localhost:9411/
99

1010
server:
1111
port: 9421
12-
12+
13+
14+
logging:
15+
level: # 日志级别
16+
root: INFO
17+
org.springframework.cloud.sleuth: DEBUG

‎ms-sleuth-service2/pom.xml

+24-10
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<groupId>org.springframework.boot</groupId>
1616
<artifactId>spring-boot-starter-parent</artifactId>
1717
<version>1.5.2.RELEASE</version>
18-
<relativePath/> <!-- lookup parent from repository -->
18+
<relativePath /> <!-- lookup parent from repository -->
1919
</parent>
2020

2121
<properties>
@@ -25,15 +25,29 @@
2525
</properties>
2626

2727
<dependencies>
28-
<dependency>
29-
<groupId>org.springframework.boot</groupId>
30-
<artifactId>spring-boot-starter</artifactId>
31-
</dependency>
32-
<dependency>
33-
<groupId>org.springframework.cloud</groupId>
34-
<artifactId>spring-cloud-starter-zipkin</artifactId>
35-
</dependency>
36-
28+
<!--
29+
<dependency>
30+
<groupId>org.springframework.cloud</groupId>
31+
<artifactId>spring-cloud-starter-sleuth</artifactId>
32+
</dependency>
33+
<dependency>
34+
<groupId>org.springframework.cloud</groupId>
35+
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
36+
</dependency>
37+
-->
38+
<dependency>
39+
<groupId>org.springframework.cloud</groupId>
40+
<artifactId>spring-cloud-sleuth-stream</artifactId>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.springframework.cloud</groupId>
44+
<artifactId>spring-cloud-starter-sleuth</artifactId>
45+
</dependency>
46+
<dependency>
47+
<groupId>org.springframework.cloud</groupId>
48+
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
49+
</dependency>
50+
3751
<dependency>
3852
<groupId>org.springframework.boot</groupId>
3953
<artifactId>spring-boot-starter-test</artifactId>

‎ms-sleuth-service2/src/main/resources/application.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ spring:
44
sleuth:
55
sampler:
66
percentage: 1.0
7-
zipkin:
8-
base-url: http://localhost:9411/
9-
enabled: true
10-
7+
rabbitmq:
8+
host: localhost
9+
port: 5672
10+
username: guest
11+
password: guest
12+
# zipkin:
13+
# base-url: http://localhost:9411/
14+
# enabled: true
15+
1116
server:
1217
port: 9422
1318

‎ms-sleuth-stream-zipkin/pom.xml

+11-11
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
<parent>
1515
<groupId>org.springframework.boot</groupId>
1616
<artifactId>spring-boot-starter-parent</artifactId>
17-
<version>1.5.2.RELEASE</version>
18-
<relativePath/> <!-- lookup parent from repository -->
17+
<version>1.5.4.RELEASE</version>
18+
<relativePath /> <!-- lookup parent from repository -->
1919
</parent>
2020

2121
<properties>
@@ -25,7 +25,7 @@
2525
</properties>
2626

2727
<dependencies>
28-
28+
2929
<dependency>
3030
<groupId>org.springframework.cloud</groupId>
3131
<artifactId>spring-cloud-sleuth-zipkin-stream</artifactId>
@@ -34,18 +34,18 @@
3434
<groupId>org.springframework.cloud</groupId>
3535
<artifactId>spring-cloud-starter-sleuth</artifactId>
3636
</dependency>
37-
<!-- EXAMPLE FOR RABBIT BINDING -->
3837
<dependency>
3938
<groupId>org.springframework.cloud</groupId>
40-
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
39+
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
4140
</dependency>
42-
43-
<dependency>
44-
<groupId>mysql</groupId>
45-
<artifactId>mysql-connector-java</artifactId>
46-
<optional>true</optional>
41+
<dependency>
42+
<groupId>io.zipkin.java</groupId>
43+
<artifactId>zipkin-autoconfigure-ui</artifactId>
44+
<scope>runtime</scope>
4745
</dependency>
4846

47+
48+
4949
<dependency>
5050
<groupId>org.springframework.boot</groupId>
5151
<artifactId>spring-boot-starter-test</artifactId>
@@ -58,7 +58,7 @@
5858
<dependency>
5959
<groupId>org.springframework.cloud</groupId>
6060
<artifactId>spring-cloud-dependencies</artifactId>
61-
<version>Camden.SR6</version>
61+
<version>Dalston.SR1</version>
6262
<type>pom</type>
6363
<scope>import</scope>
6464
</dependency>

‎ms-sleuth-stream-zipkin/src/main/resources/application.properties

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
spring:
2+
application:
3+
name: zipkin-server
4+
rabbitmq:
5+
host: localhost
6+
port: 5672
7+
username: guest
8+
password: guest
9+
10+
server:
11+
port: 9411
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11

2-
server:
3-
port: 9411
2+
#server:
3+
# port: 9411
44

55

66

7-
spring:
8-
application:
9-
name: zipkin-server
10-
rabbitmq:
11-
host: localhost
12-
datasource:
13-
initialize: false
7+
#spring:
8+
# application:
9+
# name: zipkin-server
10+
# rabbitmq:
11+
# host: localhost
12+
# port: 5672
13+
# username: guest
14+
# password: guest
1415

15-
---
16-
spring:
17-
profiles: mysql
18-
datasource:
19-
schema: classpath:/mysql.sql
20-
url: jdbc:mysql://${MYSQL_HOST:localhost}/mytest
21-
username: root
22-
password: root
23-
# Switch this on to create the schema on startup:
24-
initialize: true
25-
continueOnError: true
26-
27-
sleuth:
28-
enabled: false
29-
30-
zipkin:
31-
storage:
32-
type: mem # default is mem (in-memory) mysql
16+
#---
17+
#spring:
18+
# profiles: mysql
19+
# datasource:
20+
# schema: classpath:/mysql.sql
21+
# url: jdbc:mysql://${MYSQL_HOST:localhost}/mytest
22+
# username: root
23+
# password: root
24+
## Switch this on to create the schema on startup:
25+
# initialize: true
26+
# continueOnError: true
27+
#
28+
# sleuth:
29+
# enabled: false
30+
#
31+
#zipkin:
32+
# storage:
33+
# type: mem # default is mem (in-memory) mysql
-48.3 KB
Binary file not shown.

‎ms-sleuth-zipkin/README.md

-77
This file was deleted.

‎ms-sleuth-zipkin/src/main/resources/application.properties

-25
This file was deleted.

‎ms-sleuth-zipkin/src/main/resources/bootstrap.yml

-14
This file was deleted.

‎ms-sleuth-zipkin/src/main/resources/logback-spring.xml

-162
This file was deleted.
File renamed without changes.
46.5 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip
1+
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip

‎ms-sleuth-zipkin/mvnw ‎ms-zipkin-server/mvnw

+43-51
Original file line numberDiff line numberDiff line change
@@ -54,38 +54,16 @@ case "`uname`" in
5454
CYGWIN*) cygwin=true ;;
5555
MINGW*) mingw=true;;
5656
Darwin*) darwin=true
57-
#
58-
# Look for the Apple JDKs first to preserve the existing behaviour, and then look
59-
# for the new JDKs provided by Oracle.
60-
#
61-
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
62-
#
63-
# Apple JDKs
64-
#
65-
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
66-
fi
67-
68-
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
69-
#
70-
# Apple JDKs
71-
#
72-
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
73-
fi
74-
75-
if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
76-
#
77-
# Oracle JDKs
78-
#
79-
export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
80-
fi
81-
82-
if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
83-
#
84-
# Apple JDKs
85-
#
86-
export JAVA_HOME=`/usr/libexec/java_home`
87-
fi
88-
;;
57+
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
58+
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
59+
if [ -z "$JAVA_HOME" ]; then
60+
if [ -x "/usr/libexec/java_home" ]; then
61+
export JAVA_HOME="`/usr/libexec/java_home`"
62+
else
63+
export JAVA_HOME="/Library/Java/Home"
64+
fi
65+
fi
66+
;;
8967
esac
9068

9169
if [ -z "$JAVA_HOME" ] ; then
@@ -184,27 +162,28 @@ fi
184162

185163
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
186164

187-
# For Cygwin, switch paths to Windows format before running java
188-
if $cygwin; then
189-
[ -n "$M2_HOME" ] &&
190-
M2_HOME=`cygpath --path --windows "$M2_HOME"`
191-
[ -n "$JAVA_HOME" ] &&
192-
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
193-
[ -n "$CLASSPATH" ] &&
194-
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
195-
fi
196-
197165
# traverses directory structure from process work directory to filesystem root
198166
# first directory with .mvn subdirectory is considered project base directory
199167
find_maven_basedir() {
200-
local basedir=$(pwd)
201-
local wdir=$(pwd)
168+
169+
if [ -z "$1" ]
170+
then
171+
echo "Path not specified to find_maven_basedir"
172+
return 1
173+
fi
174+
175+
basedir="$1"
176+
wdir="$1"
202177
while [ "$wdir" != '/' ] ; do
203178
if [ -d "$wdir"/.mvn ] ; then
204179
basedir=$wdir
205180
break
206181
fi
207-
wdir=$(cd "$wdir/.."; pwd)
182+
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
183+
if [ -d "${wdir}" ]; then
184+
wdir=`cd "$wdir/.."; pwd`
185+
fi
186+
# end of workaround
208187
done
209188
echo "${basedir}"
210189
}
@@ -216,18 +195,31 @@ concat_lines() {
216195
fi
217196
}
218197

219-
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
198+
BASE_DIR=`find_maven_basedir "$(pwd)"`
199+
if [ -z "$BASE_DIR" ]; then
200+
exit 1;
201+
fi
202+
203+
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
204+
echo $MAVEN_PROJECTBASEDIR
220205
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
221206

222-
# Provide a "standardized" way to retrieve the CLI args that will
223-
# work with both Windows and non-Windows executions.
224-
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
225-
export MAVEN_CMD_LINE_ARGS
207+
# For Cygwin, switch paths to Windows format before running java
208+
if $cygwin; then
209+
[ -n "$M2_HOME" ] &&
210+
M2_HOME=`cygpath --path --windows "$M2_HOME"`
211+
[ -n "$JAVA_HOME" ] &&
212+
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
213+
[ -n "$CLASSPATH" ] &&
214+
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
215+
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
216+
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
217+
fi
226218

227219
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
228220

229221
exec "$JAVACMD" \
230222
$MAVEN_OPTS \
231223
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
232224
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
233-
${WRAPPER_LAUNCHER} "$@"
225+
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

‎ms-sleuth-zipkin/mvnw.cmd ‎ms-zipkin-server/mvnw.cmd

+3-5
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ goto error
8080

8181
:init
8282

83-
set MAVEN_CMD_LINE_ARGS=%*
84-
8583
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
8684
@REM Fallback to current working directory if not found.
8785

@@ -118,10 +116,10 @@ for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do s
118116

119117
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
120118

121-
set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar""
119+
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
122120
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
123121

124-
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
122+
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
125123
if ERRORLEVEL 1 goto error
126124
goto end
127125

@@ -142,4 +140,4 @@ if "%MAVEN_BATCH_PAUSE%" == "on" pause
142140

143141
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
144142

145-
exit /B %ERROR_CODE%
143+
exit /B %ERROR_CODE%

‎ms-sleuth-zipkin/pom.xml ‎ms-zipkin-server/pom.xml

+13-25
Original file line numberDiff line numberDiff line change
@@ -4,68 +4,56 @@
44
<modelVersion>4.0.0</modelVersion>
55

66
<groupId>com.mio</groupId>
7-
<artifactId>ms-sleuth-zipkin</artifactId>
7+
<artifactId>ms-zipkin-server</artifactId>
88
<version>0.0.1-SNAPSHOT</version>
99
<packaging>jar</packaging>
1010

11-
<name>ms-sleuth-zipkin</name>
11+
<name>ms-zipkin-server</name>
1212
<description>Demo project for Spring Boot</description>
1313

1414
<parent>
1515
<groupId>org.springframework.boot</groupId>
1616
<artifactId>spring-boot-starter-parent</artifactId>
17-
<version>1.5.2.RELEASE</version>
17+
<version>1.5.4.RELEASE</version>
1818
<relativePath /> <!-- lookup parent from repository -->
1919
</parent>
2020

2121
<properties>
2222
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2323
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
2424
<java.version>1.8</java.version>
25+
<spring-cloud.version>Dalston.SR1</spring-cloud.version>
2526
</properties>
26-
2727
<dependencyManagement>
2828
<dependencies>
2929
<dependency>
3030
<groupId>org.springframework.cloud</groupId>
3131
<artifactId>spring-cloud-dependencies</artifactId>
32-
<version>Camden.SR5</version>
32+
<version>${spring-cloud.version}</version>
3333
<type>pom</type>
3434
<scope>import</scope>
3535
</dependency>
3636
</dependencies>
3737
</dependencyManagement>
38-
3938
<dependencies>
40-
41-
<dependency>
42-
<groupId>org.springframework.cloud</groupId>
43-
<artifactId>spring-cloud-starter-zipkin</artifactId>
44-
</dependency>
45-
<!-- <dependency>
46-
<groupId>org.springframework.cloud</groupId>
47-
<artifactId>spring-cloud-starter-sleuth</artifactId>
48-
</dependency>
4939
<dependency>
50-
<groupId>org.springframework.cloud</groupId>
51-
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
52-
</dependency>-->
53-
40+
<groupId>org.springframework.boot</groupId>
41+
<artifactId>spring-boot-starter</artifactId>
42+
</dependency>
5443
<dependency>
55-
<groupId>io.zipkin.java</groupId>
56-
<artifactId>zipkin</artifactId>
44+
<groupId>org.springframework.boot</groupId>
45+
<artifactId>spring-boot-starter-web</artifactId>
5746
</dependency>
58-
47+
5948
<dependency>
6049
<groupId>io.zipkin.java</groupId>
6150
<artifactId>zipkin-server</artifactId>
6251
</dependency>
63-
6452
<dependency>
6553
<groupId>io.zipkin.java</groupId>
6654
<artifactId>zipkin-autoconfigure-ui</artifactId>
67-
</dependency>
68-
55+
</dependency>
56+
6957
<dependency>
7058
<groupId>org.springframework.boot</groupId>
7159
<artifactId>spring-boot-starter-test</artifactId>
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
package com.mio.sleuth;
1+
package com.mio.zipkin;
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
55

6+
import zipkin.server.EnableZipkinServer;
67

78
@SpringBootApplication
8-
//@EnableZipkinStreamServer
99
@EnableZipkinServer
10-
public class MsSleuthZipkinApplication {
10+
public class MsZipkinServerApplication {
1111

12-
1312
public static void main(String[] args) {
14-
SpringApplication.run(MsSleuthZipkinApplication.class, args);
13+
SpringApplication.run(MsZipkinServerApplication.class, args);
1514
}
16-
1715
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
spring:
2+
application:
3+
name: zipkin-server
4+
5+
server:
6+
port: 9411
7+

‎ms-sleuth-zipkin/src/test/java/com/mio/sleuth/MsSleuthZipkinApplicationTests.java ‎ms-zipkin-server/src/test/java/com/mio/zipkin/MsZipkinServerApplicationTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.mio.sleuth;
1+
package com.mio.zipkin;
22

33
import org.junit.Test;
44
import org.junit.runner.RunWith;
@@ -7,7 +7,7 @@
77

88
@RunWith(SpringRunner.class)
99
@SpringBootTest
10-
public class MsSleuthZipkinApplicationTests {
10+
public class MsZipkinServerApplicationTests {
1111

1212
@Test
1313
public void contextLoads() {

0 commit comments

Comments
 (0)
Please sign in to comment.