cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [2/2] cxf git commit: CXF-7247: Support tracing using latest Zipkin Brave 4.x release
Date Mon, 22 May 2017 21:33:57 GMT
CXF-7247: Support tracing using latest Zipkin Brave 4.x release


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c2517eb5
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c2517eb5
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c2517eb5

Branch: refs/heads/master
Commit: c2517eb552704a406cfbc45eba4822a84e5ca7da
Parents: ff83906
Author: reta <drreta@gmail.com>
Authored: Mon May 22 09:26:41 2017 -0400
Committer: reta <drreta@gmail.com>
Committed: Mon May 22 16:35:40 2017 -0400

----------------------------------------------------------------------
 .../java/demo/jaxrs/tracing/client/Client.java  |   6 +-
 .../samples/jaxws_tracing_brave_osgi/README.txt |  19 +--
 .../samples/jaxws_tracing_brave_osgi/pom.xml    |   4 +-
 .../jaxws/tracing/server/CatalogService.java    |   2 +-
 .../tracing/server/impl/CatalogServiceImpl.java |  19 +--
 .../resources/OSGI-INF/blueprint/context.xml    |   6 +-
 integration/tracing/tracing-brave/pom.xml       |   6 +-
 .../brave/AbstractBraveClientInterceptor.java   |   6 +-
 .../brave/AbstractBraveClientProvider.java      |  84 ++++++-----
 .../tracing/brave/AbstractBraveInterceptor.java |   9 +-
 .../tracing/brave/AbstractBraveProvider.java    | 141 +++++++++----------
 .../cxf/tracing/brave/BraveClientFeature.java   |  19 ++-
 .../brave/BraveClientStartInterceptor.java      |  10 +-
 .../brave/BraveClientStopInterceptor.java       |  10 +-
 .../apache/cxf/tracing/brave/BraveFeature.java  |  23 ++-
 .../tracing/brave/BraveStartInterceptor.java    |  11 +-
 .../cxf/tracing/brave/BraveStopInterceptor.java |  16 +--
 .../cxf/tracing/brave/BraveTracerContext.java   |  60 ++++----
 .../tracing/brave/ClientSpanNameProvider.java   |  39 -----
 .../cxf/tracing/brave/HttpClientSpanParser.java |  39 +++++
 .../cxf/tracing/brave/HttpServerSpanParser.java |  39 +++++
 .../tracing/brave/ServerSpanNameProvider.java   |  39 -----
 .../apache/cxf/tracing/brave/TraceScope.java    |  30 ++--
 .../brave/internal/HttpAdapterFactory.java      |  69 +++++++++
 .../internal/HttpClientAdapterFactory.java      |  89 ++++++++++++
 .../internal/HttpServerAdapterFactory.java      |  89 ++++++++++++
 .../brave/jaxrs/BraveClientProvider.java        |  19 ++-
 .../brave/jaxrs/BraveContextProvider.java       |  12 +-
 .../cxf/tracing/brave/jaxrs/BraveFeature.java   |  25 +++-
 .../cxf/tracing/brave/jaxrs/BraveProvider.java  |  19 ++-
 .../cxf/tracing/brave/BraveTraceTest.java       |   7 +-
 .../tracing/brave/LoggingSpanNameProvider.java  |  31 ----
 .../features/src/main/resources/features.xml    |   9 +-
 parent/pom.xml                                  |  12 +-
 .../cxf/systest/brave/BraveTestSupport.java     |  70 +++++++++
 .../cxf/systest/jaxrs/tracing/BookStore.java    |  10 +-
 .../jaxrs/tracing/brave/BraveTracingTest.java   | 136 ++++++++++--------
 .../systest/jaxws/tracing/brave/BookStore.java  |  22 ++-
 .../jaxws/tracing/brave/BraveTracingTest.java   | 114 ++++++++-------
 39 files changed, 869 insertions(+), 501 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/distribution/src/main/release/samples/jax_rs/tracing_brave/src/main/java/demo/jaxrs/tracing/client/Client.java
----------------------------------------------------------------------
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 6390237..a1fc3a6 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
@@ -24,17 +24,17 @@ import java.util.Arrays;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
-import com.github.kristofa.brave.Brave;
-
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.tracing.brave.jaxrs.BraveClientProvider;
 
+import brave.Tracing;
+
 public final class Client {
     private Client() {
     }
 
     public static void main(final String[] args) throws Exception {
-        final Brave brave = new Brave.Builder().build();
+        final Tracing brave = Tracing.newBuilder().build();
         final BraveClientProvider provider = new BraveClientProvider(brave);
 
         final Response response = WebClient

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/README.txt
----------------------------------------------------------------------
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 9b8903a..72c6ab5 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
@@ -5,20 +5,13 @@ The demo shows a basic usage of Brave/OpenZipkin distributed tracer with REST ba
 Web Services using  JAX-RS 2.0 (JSR-339). The REST server provides the 
 following services: 
 
-A RESTful catalog service is provided on URL http://localhost:9000/catalog 
-
-A HTTP GET request to URL http://localhost:8181/cxf/catalog generates following 
-traces:
-
-A HTTP POST request to URL http://localhost:8181/cxf/catalog generates following 
-traces:
-
-A HTTP GET request to URL http://localhost:8181/cxf/catalog/<id> generates following 
-traces:
-
-A HTTP DELETE request to URL http://localhost:8181/cxf/catalog/<id> generates following 
-traces:
+A SOAP catalog service is provided on URL http://localhost:8181/cxf/catalog. The WSDL 
+contract is available at http://localhost:8181/cxf/catalog?wsdl.
 
+There are three SOAP actions:
+  - addBook
+  - deleteBook
+  - getBook
 
 Building and running the demo using Maven
 ---------------------------------------

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/pom.xml b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/pom.xml
index bc28ee7..407e2f0 100644
--- a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/pom.xml
+++ b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/pom.xml
@@ -84,9 +84,7 @@
                             javax.ws.rs.container,
                             org.apache.cxf.tracing.brave,
                             org.osgi.service.blueprint,
-                            javax.annotation;version="[1.2,2)",
-                            org.apache.johnzon.core,
-                            !com.github.kristofa.brave.Brave,
+                            brave,
                             *
                         </Import-Package>
                         <Export-Package>

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/server/CatalogService.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/server/CatalogService.java b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/server/CatalogService.java
index 1d79122..5d2c1de 100644
--- a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/server/CatalogService.java
+++ b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/server/CatalogService.java
@@ -25,5 +25,5 @@ import javax.jws.WebService;
 public interface CatalogService {
     void addBook(Book book);
     Book getBook(final String id);
-    void delete(final String id);
+    void deleteBook(final String id);
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/server/impl/CatalogServiceImpl.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/server/impl/CatalogServiceImpl.java b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/server/impl/CatalogServiceImpl.java
index 74e1f3a..39f94c8 100644
--- a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/server/impl/CatalogServiceImpl.java
+++ b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/java/demo/jaxws/tracing/server/impl/CatalogServiceImpl.java
@@ -26,21 +26,22 @@ import java.util.concurrent.Future;
 
 import javax.xml.ws.AsyncHandler;
 
-import com.github.kristofa.brave.Brave;
-
 import org.apache.cxf.annotations.UseAsyncMethod;
 import org.apache.cxf.jaxws.ServerAsyncResponse;
 
+import brave.Span;
+import brave.Tracer.SpanInScope;
+import brave.Tracing;
+
 import demo.jaxws.tracing.server.Book;
 import demo.jaxws.tracing.server.CatalogService;
-import zipkin.Constants;
 
 public class CatalogServiceImpl implements CatalogService {
     private final ExecutorService executor = Executors.newFixedThreadPool(2);
     private final Map<String, Book> books = new ConcurrentHashMap<>();
-    private final Brave brave;
+    private final Tracing brave;
 
-    public CatalogServiceImpl(final Brave brave) {
+    public CatalogServiceImpl(final Tracing brave) {
         this.brave = brave;
     }
 
@@ -53,12 +54,12 @@ public class CatalogServiceImpl implements CatalogService {
         final ServerAsyncResponse<Book> response = new ServerAsyncResponse<Book>();
 
         executor.submit(() -> {
-            try {
-                brave.localTracer().startNewSpan(Constants.LOCAL_COMPONENT, "Inserting New Book");
+            final Span span = brave.tracer().nextSpan().name("Inserting New Book").start();
+            try (final SpanInScope scope = brave.tracer().withSpanInScope(span)) {
                 books.put(book.getId(), book);
                 handler.handleResponse(response);
             } finally {
-                brave.localTracer().finishSpan();
+                span.finish();
             }
         });
 
@@ -77,7 +78,7 @@ public class CatalogServiceImpl implements CatalogService {
     }
 
     @Override
-    public void delete(final String id) {
+    public void deleteBook(final String id) {
         if (books.remove(id) == null) {
             throw new RuntimeException("Book with does not exists: " + id);
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/resources/OSGI-INF/blueprint/context.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/resources/OSGI-INF/blueprint/context.xml b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/resources/OSGI-INF/blueprint/context.xml
index 102bac4..95110ed 100644
--- a/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/resources/OSGI-INF/blueprint/context.xml
+++ b/distribution/src/main/release/samples/jaxws_tracing_brave_osgi/src/main/resources/OSGI-INF/blueprint/context.xml
@@ -42,11 +42,13 @@
         <argument index="0" ref="brave" />
     </bean>
     
-    <bean id="braveBuilder" class="com.github.kristofa.brave.Brave.Builder">
+    <bean id="braveBuilder" class="brave.Tracing" factory-method="newBuilder" />
+
+    <bean id="braveCatalogBuilder" factory-ref="braveBuilder" factory-method="localServiceName">
         <argument index="0" value="catalog-service" />
     </bean>
     
-    <bean id="brave" factory-ref="braveBuilder" factory-method="build" />
+    <bean id="brave" factory-ref="braveCatalogBuilder" factory-method="build" />
     
     <jaxws:endpoint
         implementor="#catalogServiceImpl"

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/pom.xml
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/pom.xml b/integration/tracing/tracing-brave/pom.xml
index 281c5d4..31911eb 100644
--- a/integration/tracing/tracing-brave/pom.xml
+++ b/integration/tracing/tracing-brave/pom.xml
@@ -69,7 +69,11 @@
         </dependency>
         <dependency>
             <groupId>io.zipkin.brave</groupId>
-            <artifactId>brave-http</artifactId>
+            <artifactId>brave</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.zipkin.brave</groupId>
+            <artifactId>brave-instrumentation-http</artifactId>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveClientInterceptor.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveClientInterceptor.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveClientInterceptor.java
index dc1ec08..2e0c6a1 100644
--- a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveClientInterceptor.java
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveClientInterceptor.java
@@ -22,17 +22,17 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Set;
 
-import com.github.kristofa.brave.Brave;
-
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.PhaseInterceptor;
 
+import brave.http.HttpTracing;
+
 public abstract class AbstractBraveClientInterceptor extends AbstractBraveClientProvider
         implements PhaseInterceptor<Message> {
 
     private String phase;
 
-    protected AbstractBraveClientInterceptor(final String phase, final Brave brave) {
+    protected AbstractBraveClientInterceptor(final String phase, final HttpTracing brave) {
         super(brave);
         this.phase = phase;
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveClientProvider.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveClientProvider.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveClientProvider.java
index 22ddc60..f0f2ebb 100644
--- a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveClientProvider.java
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveClientProvider.java
@@ -24,61 +24,63 @@ import java.util.List;
 import java.util.Map;
 import java.util.logging.Logger;
 
-import com.github.kristofa.brave.Brave;
-import com.github.kristofa.brave.http.HttpClientRequest;
-import com.github.kristofa.brave.http.HttpClientRequestAdapter;
-import com.github.kristofa.brave.http.HttpClientResponseAdapter;
-import com.github.kristofa.brave.http.HttpResponse;
-import com.github.kristofa.brave.http.SpanNameProvider;
-import com.twitter.zipkin.gen.Span;
-
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.tracing.AbstractTracingProvider;
+import org.apache.cxf.tracing.brave.internal.HttpAdapterFactory;
+import org.apache.cxf.tracing.brave.internal.HttpAdapterFactory.Request;
+import org.apache.cxf.tracing.brave.internal.HttpAdapterFactory.Response;
+import org.apache.cxf.tracing.brave.internal.HttpClientAdapterFactory;
+
+import brave.Span;
+import brave.http.HttpClientAdapter;
+import brave.http.HttpClientHandler;
+import brave.http.HttpTracing;
+import brave.propagation.Propagation.Setter;
 
 public abstract class AbstractBraveClientProvider extends AbstractTracingProvider {
     protected static final Logger LOG = LogUtils.getL7dLogger(AbstractBraveClientProvider.class);
     protected static final String TRACE_SPAN = "org.apache.cxf.tracing.client.brave.span";
 
-    private final Brave brave;
-    private final SpanNameProvider spanNameProvider;
+    private final HttpTracing brave;
 
-    public AbstractBraveClientProvider(final Brave brave) {
+    public AbstractBraveClientProvider(final HttpTracing brave) {
         this.brave = brave;
-        this.spanNameProvider = new ClientSpanNameProvider();
     }
 
     protected TraceScopeHolder<Span> startTraceSpan(final Map<String, List<String>> requestHeaders,
             URI uri, String method) {
-        final HttpClientRequest request = new HttpClientRequest() {
-            @Override
-            public URI getUri() {
-                return uri;
-            }
 
-            @Override
-            public String getHttpMethod() {
-                return method;
-            }
+        final Request request = HttpAdapterFactory.request(requestHeaders, uri, method);
+        final HttpClientAdapter<Request, ?> adapter = HttpClientAdapterFactory.create(request);
+        
+        @SuppressWarnings("unchecked")
+        final HttpClientHandler<Request, ?> handler = HttpClientHandler.create(brave, adapter);
+        final Span span = handler.handleSend(
+            brave
+                .tracing()
+                .propagation()
+                .injector(inject(requestHeaders)), 
+            request);
 
-            @Override
-            public void addHeader(String header, String value) {
-                requestHeaders.put(header, Collections.singletonList(value));
-            }
-        };
-
-        brave.clientRequestInterceptor().handle(new HttpClientRequestAdapter(request, spanNameProvider));
-        final Span span = brave.clientSpanThreadBinder().getCurrentClientSpan();
         // In case of asynchronous client invocation, the span should be detached as JAX-RS
         // client request / response filters are going to be executed in different threads.
         boolean detached = false;
         if (isAsyncInvocation() && span != null) {
-            brave.clientSpanThreadBinder().setCurrentSpan(null);
+            // No need to detach implicitly, Brave is using inheritable thread local context 
             detached = true;
         }
 
         return new TraceScopeHolder<Span>(span, detached);
     }
+    
+    private <C> Setter<C, String> inject(final Map<String, List<String>> requestHeaders) {
+        return (carrier, key, value) -> {
+            if (!requestHeaders.containsKey(key)) {
+                requestHeaders.put(key, Collections.singletonList(value));
+            }
+        };
+    }
 
     private boolean isAsyncInvocation() {
         return !JAXRSUtils.getCurrentMessage().getExchange().isSynchronous();
@@ -91,14 +93,22 @@ public abstract class AbstractBraveClientProvider extends AbstractTracingProvide
 
         final Span span = holder.getScope();
         if (span != null) {
-            // If the client invocation was asynchronous , the trace span has been created
-            // in another thread and should be re-attached to the current one.
-            if (holder.isDetached()) {
-                brave.clientSpanThreadBinder().setCurrentSpan(span);
+            try {
+                // If the client invocation was asynchronous , the trace span has been created
+                // in another thread and should be re-attached to the current one.
+                if (holder.isDetached()) {
+                    brave.tracing().tracer().joinSpan(span.context());
+                }
+    
+                final Response response = HttpAdapterFactory.response(responseStatus);
+                final HttpClientAdapter<?, Response> adapter = HttpClientAdapterFactory.create(response);
+                
+                @SuppressWarnings("unchecked")
+                final HttpClientHandler<?, Response> handler = HttpClientHandler.create(brave, adapter);
+                handler.handleReceive(response, null, span);
+            } finally {
+                span.finish();
             }
-
-            final HttpResponse response = () -> responseStatus;
-            brave.clientResponseInterceptor().handle(new HttpClientResponseAdapter(response));
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveInterceptor.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveInterceptor.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveInterceptor.java
index 15d9511..58b67f8 100644
--- a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveInterceptor.java
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveInterceptor.java
@@ -28,14 +28,13 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import com.github.kristofa.brave.Brave;
-import com.github.kristofa.brave.http.SpanNameProvider;
-
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.PhaseInterceptor;
 
+import brave.http.HttpTracing;
+
 public abstract class AbstractBraveInterceptor extends AbstractBraveProvider implements PhaseInterceptor<Message> {
     private final String phase;
 
@@ -122,8 +121,8 @@ public abstract class AbstractBraveInterceptor extends AbstractBraveProvider imp
         }
     }
 
-    protected AbstractBraveInterceptor(String phase, Brave brave, SpanNameProvider spanNameProvider) {
-        super(brave, spanNameProvider);
+    protected AbstractBraveInterceptor(String phase, HttpTracing brave) {
+        super(brave);
         this.phase = phase;
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveProvider.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveProvider.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveProvider.java
index c9e4029..e7ae27c 100644
--- a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveProvider.java
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/AbstractBraveProvider.java
@@ -23,118 +23,113 @@ import java.util.List;
 import java.util.Map;
 import java.util.logging.Logger;
 
-import com.github.kristofa.brave.Brave;
-import com.github.kristofa.brave.ServerSpan;
-import com.github.kristofa.brave.http.BraveHttpHeaders;
-import com.github.kristofa.brave.http.HttpResponse;
-import com.github.kristofa.brave.http.HttpServerRequest;
-import com.github.kristofa.brave.http.HttpServerRequestAdapter;
-import com.github.kristofa.brave.http.HttpServerResponseAdapter;
-import com.github.kristofa.brave.http.SpanNameProvider;
-
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.phase.PhaseInterceptorChain;
 import org.apache.cxf.tracing.AbstractTracingProvider;
+import org.apache.cxf.tracing.brave.internal.HttpAdapterFactory;
+import org.apache.cxf.tracing.brave.internal.HttpAdapterFactory.Request;
+import org.apache.cxf.tracing.brave.internal.HttpAdapterFactory.Response;
+import org.apache.cxf.tracing.brave.internal.HttpServerAdapterFactory;
+
+import brave.Span;
+import brave.Tracer.SpanInScope;
+import brave.http.HttpServerAdapter;
+import brave.http.HttpServerHandler;
+import brave.http.HttpTracing;
 
 public abstract class AbstractBraveProvider extends AbstractTracingProvider {
     protected static final Logger LOG = LogUtils.getL7dLogger(AbstractBraveProvider.class);
     protected static final String TRACE_SPAN = "org.apache.cxf.tracing.brave.span";
 
-    protected final Brave brave;
-    protected final SpanNameProvider spanNameProvider;
-
-    protected AbstractBraveProvider(final Brave brave) {
-        this(brave, new ServerSpanNameProvider());
-    }
-
-    protected AbstractBraveProvider(final Brave brave, final SpanNameProvider spanNameProvider) {
+    protected final HttpTracing brave;
+    
+    protected AbstractBraveProvider(final HttpTracing brave) {
         this.brave = brave;
-        this.spanNameProvider = spanNameProvider;
     }
 
-    protected TraceScopeHolder<ServerSpan> startTraceSpan(final Map<String, List<String>> requestHeaders,
+    protected TraceScopeHolder<TraceScope> startTraceSpan(final Map<String, List<String>> requestHeaders,
             URI uri, String method) {
 
-        final HttpServerRequest request = new HttpServerRequest() {
-            @Override
-            public URI getUri() {
-                return uri;
-            }
-
-            @Override
-            public String getHttpMethod() {
-                return method;
-            }
-
-            @Override
-            public String getHttpHeaderValue(String headerName) {
-                List<String> value = requestHeaders.get(headerName);
-
-                if (value != null && !value.isEmpty()) {
-                    return value.get(0);
-                }
-
-                return null;
-            }
-        };
-
-        brave.serverRequestInterceptor().handle(new HttpServerRequestAdapter(request, spanNameProvider));
-        final ServerSpan serverSpan = brave.serverSpanThreadBinder().getCurrentServerSpan();
+        final Request request = HttpAdapterFactory.request(requestHeaders, uri, method);
+        final HttpServerAdapter<Request, ?> adapter = HttpServerAdapterFactory.create(request);
+        
+        @SuppressWarnings("unchecked")
+        final HttpServerHandler<Request, ?> handler = HttpServerHandler.create(brave, adapter);
+        
+        Span span = handler.handleReceive(
+            brave
+                .tracing()
+                .propagation()
+                .extractor(adapter::requestHeader), 
+            request);
+        
+        SpanInScope scope = null;
+        if (span != null && !span.isNoop()) {
+            scope = brave.tracing().tracer().withSpanInScope(span);
+        }
 
         // If the service resource is using asynchronous processing mode, the trace
         // scope will be closed in another thread and as such should be detached.
         boolean detached = false;
         if (isAsyncResponse()) {
-            brave.serverSpanThreadBinder().setCurrentSpan(null);
-            propagateContinuationSpan(serverSpan);
+            propagateContinuationSpan(span);
             detached = true;
         }
 
-        return new TraceScopeHolder<ServerSpan>(serverSpan, detached);
-    }
-
-    private void transferRequestHeader(final Map<String, List<String>> requestHeaders,
-            final Map<String, List<Object>> responseHeaders, final BraveHttpHeaders header) {
-        if (requestHeaders.containsKey(header.getName())) {
-            responseHeaders.put(header.getName(), CastUtils.cast(requestHeaders.get(header.getName())));
-        }
+        return new TraceScopeHolder<TraceScope>(new TraceScope(span, scope), detached);
     }
 
     protected void stopTraceSpan(final Map<String, List<String>> requestHeaders,
                                  final Map<String, List<Object>> responseHeaders,
                                  final int responseStatus,
-                                 final TraceScopeHolder<ServerSpan> holder) {
+                                 final TraceScopeHolder<TraceScope> holder) {
 
         // Transfer tracing headers into the response headers
-        transferRequestHeader(requestHeaders, responseHeaders, BraveHttpHeaders.SpanId);
-        transferRequestHeader(requestHeaders, responseHeaders, BraveHttpHeaders.Sampled);
-        transferRequestHeader(requestHeaders, responseHeaders, BraveHttpHeaders.ParentSpanId);
-        transferRequestHeader(requestHeaders, responseHeaders, BraveHttpHeaders.TraceId);
+        brave
+            .tracing()
+            .propagation()
+            .keys()
+            .forEach(key -> transferRequestHeader(requestHeaders, responseHeaders, key));
 
         if (holder == null) {
             return;
         }
 
-        final ServerSpan span = holder.getScope();
-        if (span != null) {
-            // If the service resource is using asynchronous processing mode, the trace
-            // scope has been created in another thread and should be re-attached to the current
-            // one.
-            if (holder.isDetached()) {
-                brave.serverSpanThreadBinder().setCurrentSpan(span);
+        final TraceScope scope = holder.getScope();
+        if (scope != null) {
+            try {
+                // If the service resource is using asynchronous processing mode, the trace
+                // scope has been created in another thread and should be re-attached to the current
+                // one.
+                if (holder.isDetached()) {
+                    brave.tracing().tracer().joinSpan(scope.getSpan().context());
+                }
+    
+                final Response response = HttpAdapterFactory.response(responseStatus);
+                final HttpServerAdapter<?, Response> adapter = HttpServerAdapterFactory.create(response);
+                
+                @SuppressWarnings("unchecked")
+                final HttpServerHandler<?, Response> handler = HttpServerHandler.create(brave, adapter);
+                handler.handleSend(response, null, scope.getSpan());
+            } finally {
+                scope.close();
             }
-
-            final HttpResponse response = () -> responseStatus;
-            brave.serverResponseInterceptor().handle(new HttpServerResponseAdapter(response));
         }
     }
 
-    private void propagateContinuationSpan(final ServerSpan continuationScope) {
-        PhaseInterceptorChain.getCurrentMessage().put(ServerSpan.class, continuationScope);
-    }
-
     protected boolean isAsyncResponse() {
         return !PhaseInterceptorChain.getCurrentMessage().getExchange().isSynchronous();
     }
+
+    private void propagateContinuationSpan(final Span continuationScope) {
+        PhaseInterceptorChain.getCurrentMessage().put(Span.class, continuationScope);
+    }
+
+    private void transferRequestHeader(final Map<String, List<String>> requestHeaders,
+            final Map<String, List<Object>> responseHeaders, final String header) {
+        if (requestHeaders.containsKey(header)) {
+            responseHeaders.put(header, CastUtils.cast(requestHeaders.get(header)));
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveClientFeature.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveClientFeature.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveClientFeature.java
index 039b241..7e4a7c6 100644
--- a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveClientFeature.java
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveClientFeature.java
@@ -18,8 +18,6 @@
  */
 package org.apache.cxf.tracing.brave;
 
-import com.github.kristofa.brave.Brave;
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.annotations.Provider;
 import org.apache.cxf.annotations.Provider.Scope;
@@ -28,13 +26,25 @@ import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.interceptor.InterceptorProvider;
 
+import brave.Tracing;
+import brave.http.HttpTracing;
+
 @NoJSR250Annotations
 @Provider(value = Type.Feature, scope = Scope.Client)
 public class BraveClientFeature extends AbstractFeature {
     private BraveClientStartInterceptor out;
     private BraveClientStopInterceptor in;
 
-    public BraveClientFeature(Brave brave) {
+    public BraveClientFeature(final Tracing tracing) {
+        this(
+          HttpTracing
+              .newBuilder(tracing)
+              .clientParser(new HttpClientSpanParser())
+              .build()
+         );
+    }
+    
+    public BraveClientFeature(HttpTracing brave) {
         out = new BraveClientStartInterceptor(brave);
         in = new BraveClientStopInterceptor(brave);
     }
@@ -42,9 +52,6 @@ public class BraveClientFeature extends AbstractFeature {
     @Override
     protected void initializeProvider(InterceptorProvider provider, Bus bus) {
         provider.getInInterceptors().add(in);
-        provider.getInFaultInterceptors().add(in);
-
         provider.getOutInterceptors().add(out);
-        provider.getOutFaultInterceptors().add(out);
     }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveClientStartInterceptor.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveClientStartInterceptor.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveClientStartInterceptor.java
index 0eb23ad..fdedcee 100644
--- a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveClientStartInterceptor.java
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveClientStartInterceptor.java
@@ -18,20 +18,20 @@
  */
 package org.apache.cxf.tracing.brave;
 
-import com.github.kristofa.brave.Brave;
-import com.twitter.zipkin.gen.Span;
-
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.tracing.brave.AbstractBraveInterceptor.ParsedMessage;
 
+import brave.Span;
+import brave.http.HttpTracing;
+
 public class BraveClientStartInterceptor extends AbstractBraveClientInterceptor {
-    public BraveClientStartInterceptor(final Brave brave) {
+    public BraveClientStartInterceptor(final HttpTracing brave) {
         this(Phase.PRE_STREAM, brave);
     }
 
-    public BraveClientStartInterceptor(final String phase, final Brave brave) {
+    public BraveClientStartInterceptor(final String phase, final HttpTracing brave) {
         super(phase, brave);
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveClientStopInterceptor.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveClientStopInterceptor.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveClientStopInterceptor.java
index dd6162d..8e4487b 100644
--- a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveClientStopInterceptor.java
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveClientStopInterceptor.java
@@ -18,19 +18,19 @@
  */
 package org.apache.cxf.tracing.brave;
 
-import com.github.kristofa.brave.Brave;
-import com.twitter.zipkin.gen.Span;
-
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 
+import brave.Span;
+import brave.http.HttpTracing;
+
 public class BraveClientStopInterceptor extends AbstractBraveClientInterceptor {
-    public BraveClientStopInterceptor(final Brave brave) {
+    public BraveClientStopInterceptor(final HttpTracing brave) {
         this(Phase.RECEIVE, brave);
     }
 
-    public BraveClientStopInterceptor(final String phase, final Brave brave) {
+    public BraveClientStopInterceptor(final String phase, final HttpTracing brave) {
         super(phase, brave);
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveFeature.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveFeature.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveFeature.java
index 8489ef9..5f1e010 100644
--- a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveFeature.java
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveFeature.java
@@ -20,8 +20,6 @@ package org.apache.cxf.tracing.brave;
 
 import java.util.UUID;
 
-import com.github.kristofa.brave.Brave;
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.annotations.Provider;
 import org.apache.cxf.annotations.Provider.Scope;
@@ -30,6 +28,9 @@ import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.interceptor.InterceptorProvider;
 
+import brave.Tracing;
+import brave.http.HttpTracing;
+
 @NoJSR250Annotations
 @Provider(value = Type.Feature, scope = Scope.Server)
 public class BraveFeature extends AbstractFeature {
@@ -41,10 +42,24 @@ public class BraveFeature extends AbstractFeature {
     }
 
     public BraveFeature(final String name) {
-        this(new Brave.Builder(name).build());
+        this(
+            HttpTracing
+                .newBuilder(Tracing.newBuilder().localServiceName(name).build())
+                .serverParser(new HttpServerSpanParser())
+                .build()
+        );
+    }
+    
+    public BraveFeature(final Tracing tracing) {
+        this(
+          HttpTracing
+              .newBuilder(tracing)
+              .serverParser(new HttpServerSpanParser())
+              .build()
+         );
     }
 
-    public BraveFeature(Brave brave) {
+    public BraveFeature(HttpTracing brave) {
         in = new BraveStartInterceptor(brave);
         out = new BraveStopInterceptor(brave);
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveStartInterceptor.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveStartInterceptor.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveStartInterceptor.java
index be58bb8..4df7c7e 100644
--- a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveStartInterceptor.java
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveStartInterceptor.java
@@ -18,25 +18,24 @@
  */
 package org.apache.cxf.tracing.brave;
 
-import com.github.kristofa.brave.Brave;
-import com.github.kristofa.brave.ServerSpan;
-
 import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 
+import brave.http.HttpTracing;
+
 @NoJSR250Annotations
 public class BraveStartInterceptor extends AbstractBraveInterceptor {
-    public BraveStartInterceptor(Brave brave) {
-        super(Phase.PRE_INVOKE, brave, new ServerSpanNameProvider());
+    public BraveStartInterceptor(HttpTracing brave) {
+        super(Phase.PRE_INVOKE, brave);
     }
 
     @Override
     public void handleMessage(Message message) throws Fault {
         final ParsedMessage parsed = new ParsedMessage(message);
 
-        final TraceScopeHolder<ServerSpan> holder = super.startTraceSpan(parsed.getHeaders(),
+        final TraceScopeHolder<TraceScope> holder = super.startTraceSpan(parsed.getHeaders(),
             parsed.getUri(), parsed.getHttpMethod());
 
         if (holder != null) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveStopInterceptor.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveStopInterceptor.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveStopInterceptor.java
index 7ad551a..75d1d3a 100644
--- a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveStopInterceptor.java
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveStopInterceptor.java
@@ -22,9 +22,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import com.github.kristofa.brave.Brave;
-import com.github.kristofa.brave.ServerSpan;
-
 import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Fault;
@@ -32,13 +29,12 @@ import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.Phase;
 
-/**
- *
- */
+import brave.http.HttpTracing;
+
 @NoJSR250Annotations
 public class BraveStopInterceptor extends AbstractBraveInterceptor {
-    public BraveStopInterceptor(final Brave brave) {
-        super(Phase.PRE_MARSHAL, brave, new ServerSpanNameProvider());
+    public BraveStopInterceptor(final HttpTracing brave) {
+        super(Phase.PRE_MARSHAL, brave);
     }
 
     @Override
@@ -57,8 +53,8 @@ public class BraveStopInterceptor extends AbstractBraveInterceptor {
             CastUtils.cast((Map<?, ?>)requestMessage.get(Message.PROTOCOL_HEADERS));
 
         @SuppressWarnings("unchecked")
-        final TraceScopeHolder<ServerSpan> holder =
-            (TraceScopeHolder<ServerSpan>)message.getExchange().get(TRACE_SPAN);
+        final TraceScopeHolder<TraceScope> holder =
+            (TraceScopeHolder<TraceScope>)message.getExchange().get(TRACE_SPAN);
 
         Integer responseCode = (Integer)message.get(Message.RESPONSE_CODE);
         if (responseCode == null) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveTracerContext.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveTracerContext.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveTracerContext.java
index 79a167c..5e4096c 100644
--- a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveTracerContext.java
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/BraveTracerContext.java
@@ -20,52 +20,49 @@ package org.apache.cxf.tracing.brave;
 
 import java.util.concurrent.Callable;
 
-import com.github.kristofa.brave.Brave;
-import com.github.kristofa.brave.ServerSpan;
-import com.github.kristofa.brave.ServerSpanThreadBinder;
-
 import org.apache.cxf.tracing.Traceable;
 import org.apache.cxf.tracing.TracerContext;
 
-import zipkin.Constants;
+import brave.Span;
+import brave.Tracer;
+import brave.Tracer.SpanInScope;
+import brave.http.HttpTracing;
 
 public class BraveTracerContext implements TracerContext {
-    private final Brave brave;
-    private final ServerSpan continuationSpan;
-    private final ServerSpanThreadBinder serverSpanThreadBinder;
+    private final HttpTracing brave;
+    private final Tracer tracer;
+    private final Span continuationSpan;
 
-    public BraveTracerContext(final Brave brave) {
+    public BraveTracerContext(final HttpTracing brave) {
         this(brave, null);
     }
 
-    public BraveTracerContext(final Brave brave, final ServerSpan continuationSpan) {
+    public BraveTracerContext(final HttpTracing brave, final 
+            Span continuationSpan) {
         this.brave = brave;
+        this.tracer = brave.tracing().tracer();
         this.continuationSpan = continuationSpan;
-        this.serverSpanThreadBinder = brave.serverSpanThreadBinder();
     }
 
     @Override
     @SuppressWarnings("unchecked")
     public TraceScope startSpan(final String description) {
-        return new TraceScope(brave,
-            brave
-                .localTracer()
-                .startNewSpan(Constants.LOCAL_COMPONENT, description));
+        return new TraceScope(brave, tracer.nextSpan().name(description).start());
     }
 
     @Override
     public <T> T continueSpan(final Traceable<T> traceable) throws Exception {
-        boolean attached = false;
-        if (serverSpanThreadBinder.getCurrentServerSpan() != null && continuationSpan != null) {
-            serverSpanThreadBinder.setCurrentSpan(continuationSpan);
-            attached = true;
+        SpanInScope scope = null;
+        
+        if (tracer.currentSpan() != null && continuationSpan != null) {
+            scope = tracer.withSpanInScope(continuationSpan);
         }
 
         try {
             return traceable.call(new BraveTracerContext(brave));
         } finally {
-            if (continuationSpan != null && attached) {
-                serverSpanThreadBinder.setCurrentSpan(null);
+            if (continuationSpan != null && scope != null) {
+                scope.close();
             }
         }
     }
@@ -80,30 +77,25 @@ public class BraveTracerContext implements TracerContext {
         };
 
         return () -> {
-            try {
-                startSpan(description);
+            try (final TraceScope span = startSpan(description)) {
                 return callable.call();
-            } finally {
-                brave.localTracer().finishSpan();
-            }
+            } 
         };
     }
 
     @Override
     public void annotate(String key, String value) {
-        if (brave.localSpanThreadBinder().getCurrentLocalSpan() != null) {
-            brave.localTracer().submitBinaryAnnotation(key, value);
-        } else if (brave.serverSpanThreadBinder().getCurrentServerSpan() != null) {
-            brave.serverTracer().submitBinaryAnnotation(key, value);
+        final Span current = tracer.currentSpan();
+        if (current != null) {
+            current.tag(key, value);
         }
     }
 
     @Override
     public void timeline(String message) {
-        if (brave.localSpanThreadBinder().getCurrentLocalSpan() != null) {
-            brave.localTracer().submitAnnotation(message);
-        } else if (brave.serverSpanThreadBinder().getCurrentServerSpan() != null) {
-            brave.serverTracer().submitAnnotation(message);
+        final Span current = tracer.currentSpan();
+        if (current != null) {
+            current.annotate(message);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/ClientSpanNameProvider.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/ClientSpanNameProvider.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/ClientSpanNameProvider.java
deleted file mode 100644
index ade423c..0000000
--- a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/ClientSpanNameProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.tracing.brave;
-
-import com.github.kristofa.brave.http.HttpRequest;
-import com.github.kristofa.brave.http.SpanNameProvider;
-
-import org.apache.cxf.common.util.StringUtils;
-
-public class ClientSpanNameProvider implements SpanNameProvider {
-    @Override
-    public String spanName(HttpRequest request) {
-        return buildSpanDescription(request.getUri().toString(), request.getHttpMethod());
-    }
-
-    private String buildSpanDescription(final String path, final String method) {
-        if (StringUtils.isEmpty(method)) {
-            return path;
-        } else {
-            return method + " " + path;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/HttpClientSpanParser.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/HttpClientSpanParser.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/HttpClientSpanParser.java
new file mode 100644
index 0000000..a139e06
--- /dev/null
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/HttpClientSpanParser.java
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.tracing.brave;
+
+import org.apache.cxf.common.util.StringUtils;
+
+import brave.http.HttpAdapter;
+import brave.http.HttpClientParser;
+
+public class HttpClientSpanParser extends HttpClientParser {
+    @Override
+    protected <Req> String spanName(HttpAdapter<Req, ?> adapter, Req request) {
+        return buildSpanDescription(adapter.url(request), adapter.method(request));
+    }
+
+    private String buildSpanDescription(final String path, final String method) {
+        if (StringUtils.isEmpty(method)) {
+            return path;
+        } else {
+            return method + " " + path;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/HttpServerSpanParser.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/HttpServerSpanParser.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/HttpServerSpanParser.java
new file mode 100644
index 0000000..dbd477e
--- /dev/null
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/HttpServerSpanParser.java
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.tracing.brave;
+
+import org.apache.cxf.common.util.StringUtils;
+
+import brave.http.HttpAdapter;
+import brave.http.HttpServerParser;
+
+public class HttpServerSpanParser extends HttpServerParser {
+    @Override
+    protected <Req> String spanName(HttpAdapter<Req, ?> adapter, Req request) {
+        return buildSpanDescription(adapter.path(request), adapter.method(request));
+    }
+
+    private String buildSpanDescription(final String path, final String method) {
+        if (StringUtils.isEmpty(method)) {
+            return path;
+        } else {
+            return method + " " + path;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/ServerSpanNameProvider.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/ServerSpanNameProvider.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/ServerSpanNameProvider.java
deleted file mode 100644
index 5be81c1..0000000
--- a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/ServerSpanNameProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.tracing.brave;
-
-import com.github.kristofa.brave.http.HttpRequest;
-import com.github.kristofa.brave.http.SpanNameProvider;
-
-import org.apache.cxf.common.util.StringUtils;
-
-public class ServerSpanNameProvider implements SpanNameProvider {
-    @Override
-    public String spanName(HttpRequest request) {
-        return buildSpanDescription(request.getUri().getPath(), request.getHttpMethod());
-    }
-
-    private String buildSpanDescription(final String path, final String method) {
-        if (StringUtils.isEmpty(method)) {
-            return path;
-        } else {
-            return method + " " + path;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/TraceScope.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/TraceScope.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/TraceScope.java
index 144824f..27b8deb 100644
--- a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/TraceScope.java
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/TraceScope.java
@@ -20,24 +20,32 @@ package org.apache.cxf.tracing.brave;
 
 import java.io.Closeable;
 
-import com.github.kristofa.brave.Brave;
-import com.github.kristofa.brave.SpanId;
-import com.twitter.zipkin.gen.Span;
+import brave.Span;
+import brave.Tracer.SpanInScope;
+import brave.http.HttpTracing;
 
 public class TraceScope implements Closeable {
-    final Brave brave;
-    final SpanId spanId;
+    private final Span span;
+    private final SpanInScope scope;
 
-    TraceScope(final Brave brave, final SpanId spanId) {
-        this.brave = brave;
-        this.spanId = spanId;
+    TraceScope(final HttpTracing brave, final Span span) {
+        this(span, brave.tracing().tracer().withSpanInScope(span));
+    }
+
+    TraceScope(final Span span, final SpanInScope scope) {
+        this.span = span;
+        this.scope = scope;
+    }
+    
+    public Span getSpan() {
+        return span;
     }
 
     @Override
     public void close() {
-        final Span span = brave.localSpanThreadBinder().getCurrentLocalSpan();
-        if (span != null && span.getTrace_id() == spanId.traceId && span.getId() == spanId.spanId) {
-            brave.localTracer().finishSpan();
+        span.finish();
+        if (scope != null) {
+            scope.close();
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/internal/HttpAdapterFactory.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/internal/HttpAdapterFactory.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/internal/HttpAdapterFactory.java
new file mode 100644
index 0000000..4941369
--- /dev/null
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/internal/HttpAdapterFactory.java
@@ -0,0 +1,69 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.tracing.brave.internal;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+public interface HttpAdapterFactory {
+    final class Request {
+        private final Map<String, List<String>> headers;
+        private final URI uri;
+        private final String method;
+        
+        Request(Map<String, List<String>> headers, URI uri, String method) {
+            this.headers = headers;
+            this.uri = uri;
+            this.method = method;
+        }
+        
+        Map<String, List<String>> headers() {
+            return headers;
+        }
+        
+        URI uri() {
+            return uri;
+        }
+        
+        String method() {
+            return method;
+        }
+    }
+    
+    final class Response {
+        private final Integer status;
+        
+        Response(Integer status) {
+            this.status = status;
+        }
+        
+        Integer status() {
+            return status;
+        }
+    }
+    
+    static Request request(Map<String, List<String>> headers, URI uri, String method) {
+        return new Request(headers, uri, method);
+    }
+    
+    static Response response(Integer status) {
+        return new Response(status);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/internal/HttpClientAdapterFactory.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/internal/HttpClientAdapterFactory.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/internal/HttpClientAdapterFactory.java
new file mode 100644
index 0000000..7499648
--- /dev/null
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/internal/HttpClientAdapterFactory.java
@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.tracing.brave.internal;
+
+import java.util.List;
+
+import brave.http.HttpClientAdapter;
+
+public interface HttpClientAdapterFactory extends HttpAdapterFactory {
+    static HttpClientAdapter<Request, Response> create(Request request) {
+        return new HttpClientAdapter<Request, Response>() {
+            @Override 
+            public String method(Request request) {
+                return request.method();
+            }
+    
+            @Override 
+            public String path(Request request) {
+                return request.uri().getPath();
+            }
+    
+            @Override 
+            public String url(Request request) {
+                return request.uri().toString();
+            }
+    
+            @Override 
+            public String requestHeader(Request request, String name) {
+                List<String> value = request.headers().get(name);
+    
+                if (value != null && !value.isEmpty()) {
+                    return value.get(0);
+                }
+    
+                return null;
+            }
+    
+            @Override 
+            public Integer statusCode(Response response) {
+                throw new UnsupportedOperationException("The operation is not supported for request adapter");
+            }
+        };
+    }
+    
+    static HttpClientAdapter<Request, Response> create(Response response) {
+        return new HttpClientAdapter<Request, Response>() {
+            @Override 
+            public String method(Request request) {
+                throw new UnsupportedOperationException("The operation is not supported for response adapter");
+            }
+    
+            @Override 
+            public String path(Request request) {
+                throw new UnsupportedOperationException("The operation is not supported for response adapter");
+            }
+    
+            @Override 
+            public String url(Request request) {
+                throw new UnsupportedOperationException("The operation is not supported for response adapter");
+            }
+    
+            @Override 
+            public String requestHeader(Request request, String name) {
+                throw new UnsupportedOperationException("The operation is not supported for response adapter");
+            }
+    
+            @Override 
+            public Integer statusCode(Response response) {
+                return response.status();
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/internal/HttpServerAdapterFactory.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/internal/HttpServerAdapterFactory.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/internal/HttpServerAdapterFactory.java
new file mode 100644
index 0000000..69fee0f
--- /dev/null
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/internal/HttpServerAdapterFactory.java
@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.tracing.brave.internal;
+
+import java.util.List;
+
+import brave.http.HttpServerAdapter;
+
+public interface HttpServerAdapterFactory extends HttpAdapterFactory {
+    static HttpServerAdapter<Request, Response> create(Request request) {
+        return new HttpServerAdapter<Request, Response>() {
+            @Override 
+            public String method(Request request) {
+                return request.method();
+            }
+    
+            @Override 
+            public String path(Request request) {
+                return request.uri().getPath();
+            }
+    
+            @Override 
+            public String url(Request request) {
+                return request.uri().toString();
+            }
+    
+            @Override 
+            public String requestHeader(Request request, String name) {
+                List<String> value = request.headers().get(name);
+    
+                if (value != null && !value.isEmpty()) {
+                    return value.get(0);
+                }
+    
+                return null;
+            }
+    
+            @Override 
+            public Integer statusCode(Response response) {
+                throw new UnsupportedOperationException("The operation is not supported for request adapter");
+            }
+        };
+    }
+    
+    static HttpServerAdapter<Request, Response> create(Response response) {
+        return new HttpServerAdapter<Request, Response>() {
+            @Override 
+            public String method(Request request) {
+                throw new UnsupportedOperationException("The operation is not supported for response adapter");
+            }
+    
+            @Override 
+            public String path(Request request) {
+                throw new UnsupportedOperationException("The operation is not supported for response adapter");
+            }
+    
+            @Override 
+            public String url(Request request) {
+                throw new UnsupportedOperationException("The operation is not supported for response adapter");
+            }
+    
+            @Override 
+            public String requestHeader(Request request, String name) {
+                throw new UnsupportedOperationException("The operation is not supported for response adapter");
+            }
+    
+            @Override 
+            public Integer statusCode(Response response) {
+                return response.status();
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveClientProvider.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveClientProvider.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveClientProvider.java
index 23b149c..0de7c32 100644
--- a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveClientProvider.java
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveClientProvider.java
@@ -26,16 +26,27 @@ import javax.ws.rs.client.ClientResponseContext;
 import javax.ws.rs.client.ClientResponseFilter;
 import javax.ws.rs.ext.Provider;
 
-import com.github.kristofa.brave.Brave;
-import com.twitter.zipkin.gen.Span;
-
 import org.apache.cxf.tracing.brave.AbstractBraveClientProvider;
+import org.apache.cxf.tracing.brave.HttpClientSpanParser;
+
+import brave.Span;
+import brave.Tracing;
+import brave.http.HttpTracing;
 
 @Provider
 public class BraveClientProvider extends AbstractBraveClientProvider
         implements ClientRequestFilter, ClientResponseFilter {
 
-    public BraveClientProvider(final Brave brave) {
+    public BraveClientProvider(final Tracing brave) {
+        this(
+            HttpTracing
+                .newBuilder(brave)
+                .clientParser(new HttpClientSpanParser())
+                .build()
+        );
+    }
+
+    public BraveClientProvider(final HttpTracing brave) {
         super(brave);
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveContextProvider.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveContextProvider.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveContextProvider.java
index 4294eda..1f67112 100644
--- a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveContextProvider.java
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveContextProvider.java
@@ -18,25 +18,25 @@
  */
 package org.apache.cxf.tracing.brave.jaxrs;
 
-import com.github.kristofa.brave.Brave;
-import com.github.kristofa.brave.ServerSpan;
-
 import org.apache.cxf.jaxrs.ext.ContextProvider;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.tracing.TracerContext;
 import org.apache.cxf.tracing.brave.BraveTracerContext;
 
+import brave.Span;
+import brave.http.HttpTracing;
+
 public class BraveContextProvider implements ContextProvider< TracerContext > {
-    private final Brave brave;
+    private final HttpTracing brave;
 
-    public BraveContextProvider(final Brave brave) {
+    public BraveContextProvider(final HttpTracing brave) {
         this.brave = brave;
     }
 
     @Override
     public TracerContext createContext(final Message message) {
         // Check if there is a server span passed along with the message
-        final ServerSpan continuationSpan = message.get(ServerSpan.class);
+        final Span continuationSpan = message.get(Span.class);
 
         // If server span is already present, let us check if it is detached
         // (asynchronous invocation)

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveFeature.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveFeature.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveFeature.java
index d8ab77b..6652604 100644
--- a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveFeature.java
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveFeature.java
@@ -24,21 +24,38 @@ import javax.ws.rs.core.Feature;
 import javax.ws.rs.core.FeatureContext;
 import javax.ws.rs.ext.Provider;
 
-import com.github.kristofa.brave.Brave;
+import org.apache.cxf.tracing.brave.HttpServerSpanParser;
+
+import brave.Tracing;
+import brave.http.HttpTracing;
 
 @Provider
 public class BraveFeature implements Feature {
-    private final Brave brave;
+    private final HttpTracing brave;
 
     public BraveFeature() {
         this("cxf-svc-" + UUID.randomUUID().toString());
     }
 
     public BraveFeature(final String name) {
-        this(new Brave.Builder(name).build());
+        this(
+            HttpTracing
+                .newBuilder(Tracing.newBuilder().localServiceName(name).build())
+                .serverParser(new HttpServerSpanParser())
+                .build()
+        );
+    }
+
+    public BraveFeature(final Tracing tracing) {
+        this(
+          HttpTracing
+              .newBuilder(tracing)
+              .serverParser(new HttpServerSpanParser())
+              .build()
+         );
     }
 
-    public BraveFeature(final Brave brave) {
+    public BraveFeature(final HttpTracing brave) {
         this.brave = brave;
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveProvider.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveProvider.java b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveProvider.java
index e4f4f33..7a21626 100644
--- a/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveProvider.java
+++ b/integration/tracing/tracing-brave/src/main/java/org/apache/cxf/tracing/brave/jaxrs/BraveProvider.java
@@ -30,10 +30,10 @@ import javax.ws.rs.container.Suspended;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.ext.Provider;
 
-import com.github.kristofa.brave.Brave;
-import com.github.kristofa.brave.ServerSpan;
-
 import org.apache.cxf.tracing.brave.AbstractBraveProvider;
+import org.apache.cxf.tracing.brave.TraceScope;
+
+import brave.http.HttpTracing;
 
 @Provider
 public class BraveProvider extends AbstractBraveProvider
@@ -41,15 +41,14 @@ public class BraveProvider extends AbstractBraveProvider
     @Context
     private ResourceInfo resourceInfo;
 
-    public BraveProvider(final Brave brave) {
+    public BraveProvider(final HttpTracing brave) {
         super(brave);
     }
 
     @Override
     public void filter(final ContainerRequestContext requestContext) throws IOException {
-        final TraceScopeHolder<ServerSpan> holder = super.startTraceSpan(requestContext.getHeaders(),
-                                                requestContext.getUriInfo().getRequestUri(),
-                                                requestContext.getMethod());
+        final TraceScopeHolder<TraceScope> holder = super.startTraceSpan(requestContext.getHeaders(),
+            requestContext.getUriInfo().getRequestUri(), requestContext.getMethod());
 
         if (holder != null) {
             requestContext.setProperty(TRACE_SPAN, holder);
@@ -60,10 +59,8 @@ public class BraveProvider extends AbstractBraveProvider
     @Override
     public void filter(final ContainerRequestContext requestContext,
             final ContainerResponseContext responseContext) throws IOException {
-        super.stopTraceSpan(requestContext.getHeaders(),
-                            responseContext.getHeaders(),
-                            responseContext.getStatus(),
-                            (TraceScopeHolder<ServerSpan>)requestContext.getProperty(TRACE_SPAN));
+        super.stopTraceSpan(requestContext.getHeaders(), responseContext.getHeaders(),
+            responseContext.getStatus(), (TraceScopeHolder<TraceScope>)requestContext.getProperty(TRACE_SPAN));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/test/java/org/apache/cxf/tracing/brave/BraveTraceTest.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/test/java/org/apache/cxf/tracing/brave/BraveTraceTest.java b/integration/tracing/tracing-brave/src/test/java/org/apache/cxf/tracing/brave/BraveTraceTest.java
index af30930..b36fc47 100644
--- a/integration/tracing/tracing-brave/src/test/java/org/apache/cxf/tracing/brave/BraveTraceTest.java
+++ b/integration/tracing/tracing-brave/src/test/java/org/apache/cxf/tracing/brave/BraveTraceTest.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import com.github.kristofa.brave.Brave;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.feature.Feature;
 import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
@@ -32,6 +31,8 @@ import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
+
+import brave.Tracing;
 import zipkin.Span;
 import zipkin.reporter.Reporter;
 
@@ -84,12 +85,12 @@ public class BraveTraceTest {
     }
 
     private static BraveFeature createLoggingFeature(Reporter<Span> reporter) {
-        Brave brave = new Brave.Builder("myservice").reporter(reporter).build();
+        Tracing brave = Tracing.newBuilder().localServiceName("myservice").reporter(reporter).build();
         return new BraveFeature(brave);
     }
 
     private static BraveClientFeature createClientLoggingFeature(Reporter<Span> reporter) {
-        Brave brave = new Brave.Builder("myservice").reporter(reporter).build();
+        Tracing brave = Tracing.newBuilder().localServiceName("myservice").reporter(reporter).build();
         return new BraveClientFeature(brave);
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/integration/tracing/tracing-brave/src/test/java/org/apache/cxf/tracing/brave/LoggingSpanNameProvider.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-brave/src/test/java/org/apache/cxf/tracing/brave/LoggingSpanNameProvider.java b/integration/tracing/tracing-brave/src/test/java/org/apache/cxf/tracing/brave/LoggingSpanNameProvider.java
deleted file mode 100644
index 867d548..0000000
--- a/integration/tracing/tracing-brave/src/test/java/org/apache/cxf/tracing/brave/LoggingSpanNameProvider.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.tracing.brave;
-
-import com.github.kristofa.brave.http.HttpRequest;
-import com.github.kristofa.brave.http.SpanNameProvider;
-
-public class LoggingSpanNameProvider implements SpanNameProvider {
-
-    @Override
-    public String spanName(HttpRequest request) {
-        return (request instanceof SpanNameProvider) ? ((SpanNameProvider)request).spanName(request) : "";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/osgi/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/osgi/karaf/features/src/main/resources/features.xml b/osgi/karaf/features/src/main/resources/features.xml
index b21eb98..9d294f1 100644
--- a/osgi/karaf/features/src/main/resources/features.xml
+++ b/osgi/karaf/features/src/main/resources/features.xml
@@ -291,10 +291,11 @@
     </feature>
     <feature name="cxf-tracing-brave" version="${project.version}">
         <feature version="${project.version}">cxf-core</feature>
-        <bundle start-level="35">mvn:io.zipkin.java/zipkin/1.16.2</bundle>
-        <bundle start-level="35">mvn:io.zipkin.reporter/zipkin-reporter/0.6.9</bundle>
-        <bundle start-level="35">mvn:io.zipkin.brave/brave-core/${cxf.brave.version}</bundle>
-        <bundle start-level="35">mvn:io.zipkin.brave/brave-http/${cxf.brave.version}</bundle>
+        <bundle start-level="10" dependency="true">mvn:com.google.code.findbugs/jsr305/${cxf.findbugs.version}</bundle>
+        <bundle start-level="35">mvn:io.zipkin.java/zipkin/${cxf.brave.zipkin.version}</bundle>
+        <bundle start-level="35">mvn:io.zipkin.reporter/zipkin-reporter/${cxf.brave.reporter.version}</bundle>
+        <bundle start-level="35">mvn:io.zipkin.brave/brave/${cxf.brave.version}</bundle>
+        <bundle start-level="35">mvn:io.zipkin.brave/brave-instrumentation-http/${cxf.brave.version}</bundle>
         <bundle start-level="40">mvn:org.apache.cxf/cxf-integration-tracing-brave/${project.version}</bundle>
     </feature>
     <feature name="cxf-rs-description-swagger2" version="${project.version}">

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index d01bbda..355f800 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -219,7 +219,10 @@
         <cxf.jexl.version>2.1.1</cxf.jexl.version>
         <cxf.htrace.version>4.0.1-incubating</cxf.htrace.version>
         <cxf.zest.version>2.1</cxf.zest.version>
-        <cxf.brave.version>3.16.0</cxf.brave.version>
+        <cxf.brave.version>4.3.1</cxf.brave.version>
+        <cxf.brave.zipkin.version>1.24.0</cxf.brave.zipkin.version>
+        <cxf.brave.reporter.version>0.9.0</cxf.brave.reporter.version>
+        <cxf.findbugs.version>3.0.2</cxf.findbugs.version>
         <cxf.checkstyle.extension />
         <cxf.jaxb.context.class />
         <cxf.jaxb.context.class.property>none</cxf.jaxb.context.class.property>
@@ -1966,7 +1969,12 @@
             </dependency>
             <dependency>
                  <groupId>io.zipkin.brave</groupId>
-                 <artifactId>brave-http</artifactId>
+                 <artifactId>brave</artifactId>
+                 <version>${cxf.brave.version}</version>
+            </dependency>
+            <dependency>
+                 <groupId>io.zipkin.brave</groupId>
+                 <artifactId>brave-instrumentation-http</artifactId>
                  <version>${cxf.brave.version}</version>
             </dependency>
             <dependency>

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/systests/tracing/src/test/java/org/apache/cxf/systest/brave/BraveTestSupport.java
----------------------------------------------------------------------
diff --git a/systests/tracing/src/test/java/org/apache/cxf/systest/brave/BraveTestSupport.java b/systests/tracing/src/test/java/org/apache/cxf/systest/brave/BraveTestSupport.java
new file mode 100644
index 0000000..c44c9e8
--- /dev/null
+++ b/systests/tracing/src/test/java/org/apache/cxf/systest/brave/BraveTestSupport.java
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.brave;
+
+public abstract class BraveTestSupport {
+    public static final String TRACE_ID_NAME = "X-B3-TraceId";
+    public static final String SPAN_ID_NAME = "X-B3-SpanId";
+    public static final String PARENT_SPAN_ID_NAME = "X-B3-ParentSpanId";
+    public static final String SAMPLED_NAME = "X-B3-Sampled";
+    
+    public static class SpanId {
+        private long traceId;
+        private long spanId;
+        private Long parentId;
+        private boolean sampled;
+         
+        public SpanId traceId(long id) {
+            this.traceId = id;
+            return this;
+        }
+
+        public SpanId parentId(Long id) {
+            this.parentId = id;
+            return this;
+        }
+
+        public SpanId spanId(long id) {
+            this.spanId = id;
+            return this;
+        }
+        
+        public SpanId sampled(boolean s) {
+            this.sampled = s;
+            return this;
+        }
+        
+        public long traceId() {
+            return traceId;
+        }
+        
+        public long spanId() {
+            return spanId;
+        }
+        
+        public Long parentId() {
+            return parentId;
+        }
+        
+        public boolean sampled() {
+            return sampled;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/c2517eb5/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/BookStore.java
----------------------------------------------------------------------
diff --git a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/BookStore.java b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/BookStore.java
index f01cdb8..9be6a02 100644
--- a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/BookStore.java
+++ b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/BookStore.java
@@ -26,6 +26,7 @@ import java.util.UUID;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
 
 import javax.ws.rs.GET;
 import javax.ws.rs.PUT;
@@ -145,8 +146,8 @@ public class BookStore<T extends Closeable> {
     @PUT
     @Path("/process")
     @Produces(MediaType.APPLICATION_JSON)
-    public Response processBooks() {
-        executor.submit(
+    public Response processBooks() throws InterruptedException {
+        final Future<Void> future = executor.submit(
             tracer.wrap("Processing books", new Traceable<Void>() {
                 @Override
                 public Void call(final TracerContext context) throws Exception {
@@ -155,6 +156,11 @@ public class BookStore<T extends Closeable> {
                 }
             })
         );
+        
+        if (!future.isDone()) {
+            // Just give it some time to have trace finished 
+            Thread.sleep(20);
+        }
 
         return Response.ok().build();
     }


Mime
View raw message