You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2018/09/28 23:03:56 UTC
[cxf] branch 3.2.x-fixes updated: CXF-7844: Change Zipkin/Brave XML
to use brave-spring-beans. Updating to latest Brave version (5.4.1).
This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch 3.2.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/3.2.x-fixes by this push:
new d25fae4 CXF-7844: Change Zipkin/Brave XML to use brave-spring-beans. Updating to latest Brave version (5.4.1).
d25fae4 is described below
commit d25fae4a66bea5802b16c777c3a0dfb87044e976
Author: reta <dr...@gmail.com>
AuthorDate: Fri Sep 28 18:06:49 2018 -0400
CXF-7844: Change Zipkin/Brave XML to use brave-spring-beans. Updating to latest Brave version (5.4.1).
---
.../release/samples/jax_rs/tracing_brave/pom.xml | 4 ++--
.../java/demo/jaxrs/tracing/client/Client.java | 24 ++++++++++------------
.../demo/jaxrs/tracing/server/CatalogTracing.java | 22 +++++++++++++++-----
.../samples/jax_rs/tracing_brave_osgi/README.txt | 2 +-
.../samples/jaxws_tracing_brave_osgi/README.txt | 2 +-
parent/pom.xml | 6 +++---
6 files changed, 35 insertions(+), 25 deletions(-)
diff --git a/distribution/src/main/release/samples/jax_rs/tracing_brave/pom.xml b/distribution/src/main/release/samples/jax_rs/tracing_brave/pom.xml
index 2ca44c1..fa23a98 100644
--- a/distribution/src/main/release/samples/jax_rs/tracing_brave/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/tracing_brave/pom.xml
@@ -130,12 +130,12 @@
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-sender-okhttp3</artifactId>
- <version>2.7.8</version>
+ <version>2.7.9</version>
</dependency>
<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave-context-slf4j</artifactId>
- <version>5.3.3</version>
+ <version>5.4.1</version>
</dependency>
</dependencies>
</project>
diff --git a/distribution/src/main/release/samples/jax_rs/tracing_brave/src/main/java/demo/jaxrs/tracing/client/Client.java b/distribution/src/main/release/samples/jax_rs/tracing_brave/src/main/java/demo/jaxrs/tracing/client/Client.java
index 42784c2..1f8cab2 100644
--- a/distribution/src/main/release/samples/jax_rs/tracing_brave/src/main/java/demo/jaxrs/tracing/client/Client.java
+++ b/distribution/src/main/release/samples/jax_rs/tracing_brave/src/main/java/demo/jaxrs/tracing/client/Client.java
@@ -34,18 +34,16 @@ public final class Client {
}
public static void main(final String[] args) throws Exception {
- final CatalogTracing tracing = new CatalogTracing("catalog-client");
- final BraveClientProvider provider = new BraveClientProvider(tracing.getHttpTracing());
-
- final Response response = WebClient
- .create("http://localhost:9000/catalog", Arrays.asList(provider))
- .accept(MediaType.APPLICATION_JSON)
- .get();
-
- System.out.println(response.readEntity(String.class));
- response.close();
-
- // Give the tracer the time to flush traces (since we are using async reporter)
- Thread.sleep(1000);
+ try (final CatalogTracing tracing = new CatalogTracing("catalog-client")) {
+ final BraveClientProvider provider = new BraveClientProvider(tracing.getHttpTracing());
+
+ final Response response = WebClient
+ .create("http://localhost:9000/catalog", Arrays.asList(provider))
+ .accept(MediaType.APPLICATION_JSON)
+ .get();
+
+ System.out.println(response.readEntity(String.class));
+ response.close();
+ }
}
}
diff --git a/distribution/src/main/release/samples/jax_rs/tracing_brave/src/main/java/demo/jaxrs/tracing/server/CatalogTracing.java b/distribution/src/main/release/samples/jax_rs/tracing_brave/src/main/java/demo/jaxrs/tracing/server/CatalogTracing.java
index 5675642..808ae74 100644
--- a/distribution/src/main/release/samples/jax_rs/tracing_brave/src/main/java/demo/jaxrs/tracing/server/CatalogTracing.java
+++ b/distribution/src/main/release/samples/jax_rs/tracing_brave/src/main/java/demo/jaxrs/tracing/server/CatalogTracing.java
@@ -28,7 +28,9 @@ import zipkin2.reporter.AsyncReporter;
import zipkin2.reporter.Sender;
import zipkin2.reporter.okhttp3.OkHttpSender;
-public class CatalogTracing {
+public class CatalogTracing implements AutoCloseable {
+ private volatile AsyncReporter<Span> reporter;
+ private volatile Sender sender;
private volatile HttpTracing httpTracing;
private final String serviceName;
@@ -43,7 +45,9 @@ public class CatalogTracing {
synchronized(this) {
result = httpTracing;
if (result == null) {
- httpTracing = result = createHttpTracing();
+ sender = OkHttpSender.create("http://localhost:9411/api/v2/spans");
+ reporter = AsyncReporter.create(sender);
+ httpTracing = result = createHttpTracing(serviceName, reporter);
}
}
}
@@ -51,10 +55,18 @@ public class CatalogTracing {
return result;
}
- private HttpTracing createHttpTracing() {
- final Sender sender = OkHttpSender.create("http://localhost:9411/api/v2/spans");
- final AsyncReporter<Span> reporter = AsyncReporter.create(sender);
+ @Override
+ public void close() throws Exception {
+ if (reporter != null) {
+ reporter.close();
+ }
+ if (sender != null) {
+ sender.close();
+ }
+ }
+
+ private static HttpTracing createHttpTracing(String serviceName, AsyncReporter<Span> reporter) {
final Tracing tracing = Tracing
.newBuilder()
.localServiceName(serviceName)
diff --git a/distribution/src/main/release/samples/jax_rs/tracing_brave_osgi/README.txt b/distribution/src/main/release/samples/jax_rs/tracing_brave_osgi/README.txt
index a977707..6aa06d3 100644
--- a/distribution/src/main/release/samples/jax_rs/tracing_brave_osgi/README.txt
+++ b/distribution/src/main/release/samples/jax_rs/tracing_brave_osgi/README.txt
@@ -63,7 +63,7 @@ Install this demo bundle (using the appropriate bundle version number)
install -s mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.okio/1.15.0_1
install -s mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.okhttp/3.11.0_1
- install -s mvn:io.zipkin.reporter2/zipkin-sender-okhttp3/2.7.8
+ install -s mvn:io.zipkin.reporter2/zipkin-sender-okhttp3/2.7.9
install -s mvn:org.apache.cxf.samples/jax_rs_tracing_brave_osgi/3.n.m
You can verify if the CXF JAX-RS OpenZipkin Brave Blueprint Demo is installed and started.
diff --git a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/README.txt b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/README.txt
index ca97a63..b453809 100644
--- a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/README.txt
+++ b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/README.txt
@@ -61,7 +61,7 @@ Install this demo bundle (using the appropriate bundle version number)
install -s mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.okio/1.15.0_1
install -s mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.okhttp/3.11.0_1
- install -s mvn:io.zipkin.reporter2/zipkin-sender-okhttp3/2.7.8
+ install -s mvn:io.zipkin.reporter2/zipkin-sender-okhttp3/2.7.9
install -s mvn:org.apache.cxf.samples/jax_ws_tracing_brave_osgi/3.n.m
You can verify if the CXF JAX-RS OpenZipkin Brave Blueprint Demo is installed and started.
diff --git a/parent/pom.xml b/parent/pom.xml
index 8f1b5a6..671e473 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -226,9 +226,9 @@
<cxf.jexl.version>2.1.1</cxf.jexl.version>
<cxf.htrace.version>4.2.0-incubating</cxf.htrace.version>
<cxf.zest.version>2.1</cxf.zest.version>
- <cxf.brave.version>5.3.3</cxf.brave.version>
- <cxf.brave.zipkin.version>2.11.5</cxf.brave.zipkin.version>
- <cxf.brave.reporter.version>2.7.8</cxf.brave.reporter.version>
+ <cxf.brave.version>5.4.1</cxf.brave.version>
+ <cxf.brave.zipkin.version>2.11.6</cxf.brave.zipkin.version>
+ <cxf.brave.reporter.version>2.7.9</cxf.brave.reporter.version>
<cxf.opentracing.version>0.30.0</cxf.opentracing.version>
<cxf.jaeger.version>0.20.6</cxf.jaeger.version>
<cxf.findbugs.version>3.0.2</cxf.findbugs.version>