[SCB-2535] Bump brave.version from 5.6.11 to 5.13.9 (#3011)

diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml
index c814dfa..8690d4a 100644
--- a/dependencies/default/pom.xml
+++ b/dependencies/default/pom.xml
@@ -37,7 +37,7 @@
     <aspectj.version>1.9.9.1</aspectj.version>
     <awaitility.version>4.2.0</awaitility.version>
     <assertj.version>3.23.1</assertj.version>
-    <brave.version>5.6.11</brave.version>
+    <brave.version>5.13.9</brave.version>
     <classmate.version>1.5.1</classmate.version>
     <commons-beanutils.version>1.9.4</commons-beanutils.version>
     <commons-configuration.version>1.10</commons-configuration.version>
diff --git a/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ConsumerInvocationAdapter.java b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ConsumerInvocationAdapter.java
deleted file mode 100644
index 1428fa8..0000000
--- a/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ConsumerInvocationAdapter.java
+++ /dev/null
@@ -1,59 +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.servicecomb.tracing.zipkin;
-
-import javax.annotation.Nonnull;
-
-import org.apache.servicecomb.core.Invocation;
-import org.apache.servicecomb.swagger.invocation.Response;
-
-import brave.http.HttpClientAdapter;
-import zipkin2.internal.Nullable;
-
-class ConsumerInvocationAdapter extends HttpClientAdapter<Invocation, Response> {
-
-  @Nullable
-  @Override
-  public String method(@Nonnull Invocation invocation) {
-    return invocation.getOperationMeta().getHttpMethod();
-  }
-
-  @Nullable
-  @Override
-  public String url(@Nonnull Invocation invocation) {
-    return invocation.getEndpoint().getEndpoint();
-  }
-
-  @Nullable
-  @Override
-  public String path(@Nonnull Invocation request) {
-    return request.getOperationMeta().getOperationPath();
-  }
-
-  @Nullable
-  @Override
-  public String requestHeader(@Nonnull Invocation invocation, @Nonnull String key) {
-    return invocation.getContext().get(key);
-  }
-
-  @Nullable
-  @Override
-  public Integer statusCode(@Nonnull Response response) {
-    return response.getStatusCode();
-  }
-}
diff --git a/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/HttpClientRequestWrapper.java b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/HttpClientRequestWrapper.java
new file mode 100644
index 0000000..a819690
--- /dev/null
+++ b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/HttpClientRequestWrapper.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.servicecomb.tracing.zipkin;
+
+import brave.http.HttpClientRequest;
+
+import org.apache.servicecomb.core.Invocation;
+
+class HttpClientRequestWrapper extends HttpClientRequest {
+
+  private Invocation invocation;
+
+  HttpClientRequestWrapper() {
+  }
+
+  HttpClientRequestWrapper(Invocation invocation) {
+    this.invocation = invocation;
+  }
+
+  HttpClientRequestWrapper invocation(Invocation invocation) {
+    this.invocation = invocation;
+    return this;
+  }
+
+
+  @Override
+  public void header(String name, String value) {
+    invocation.addContext(name, value);
+  }
+
+  @Override
+  public String method() {
+    return invocation.getOperationMeta().getHttpMethod();
+  }
+
+  @Override
+  public String path() {
+    return invocation.getOperationMeta().getOperationPath();
+  }
+
+  @Override
+  public String url() {
+    return invocation.getEndpoint().getEndpoint();
+  }
+
+  @Override
+  public String header(String name) {
+    return invocation.getContext().get(name);
+  }
+
+  @Override
+  public Object unwrap() {
+    return invocation;
+  }
+}
diff --git a/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/HttpClientResponseWrapper.java b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/HttpClientResponseWrapper.java
new file mode 100644
index 0000000..3cc0705
--- /dev/null
+++ b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/HttpClientResponseWrapper.java
@@ -0,0 +1,78 @@
+/*
+ * 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.servicecomb.tracing.zipkin;
+
+import brave.http.HttpClientRequest;
+import brave.http.HttpClientResponse;
+import brave.internal.Nullable;
+
+import org.apache.servicecomb.swagger.invocation.Response;
+
+class HttpClientResponseWrapper extends HttpClientResponse {
+  @Nullable
+  HttpClientRequest request;
+
+  @Nullable
+  Response response;
+
+  @Nullable
+  Throwable error;
+
+  HttpClientResponseWrapper() {
+  }
+
+  HttpClientResponseWrapper(@Nullable Response response, @Nullable Throwable error) {
+    this.response = response;
+    this.error = error;
+  }
+
+  HttpClientResponseWrapper response(Response response) {
+    this.response = response;
+    return this;
+  }
+
+  HttpClientResponseWrapper throwable(Throwable error) {
+    this.error = error;
+    return this;
+  }
+
+  HttpClientResponseWrapper request(HttpClientRequest request) {
+    this.request = request;
+    return this;
+  }
+
+  @Override
+  public int statusCode() {
+    return response.getStatusCode();
+  }
+
+  @Override
+  public Object unwrap() {
+    return response;
+  }
+
+  @Override
+  public HttpClientRequest request() {
+    return request;
+  }
+
+  @Override
+  public Throwable error() {
+    return error;
+  }
+}
diff --git a/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ProviderInvocationAdapter.java b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/HttpServeRequestWrapper.java
similarity index 61%
rename from handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ProviderInvocationAdapter.java
rename to handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/HttpServeRequestWrapper.java
index da12ab6..5503cc4 100644
--- a/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ProviderInvocationAdapter.java
+++ b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/HttpServeRequestWrapper.java
@@ -17,43 +17,47 @@
 
 package org.apache.servicecomb.tracing.zipkin;
 
-import javax.annotation.Nonnull;
+import brave.http.HttpServerRequest;
 
 import org.apache.servicecomb.core.Invocation;
-import org.apache.servicecomb.swagger.invocation.Response;
 
-import brave.http.HttpServerAdapter;
-import zipkin2.internal.Nullable;
+class HttpServeRequestWrapper extends HttpServerRequest {
+  private Invocation invocation;
 
-class ProviderInvocationAdapter extends HttpServerAdapter<Invocation, Response> {
+  HttpServeRequestWrapper() {
+  }
 
-  @Nullable
+  HttpServeRequestWrapper(Invocation invocation) {
+    this.invocation = invocation;
+  }
+
+  HttpServeRequestWrapper invocation(Invocation invocation) {
+    this.invocation = invocation;
+    return this;
+  }
+
   @Override
-  public String method(@Nonnull Invocation invocation) {
+  public String method() {
     return invocation.getOperationMeta().getHttpMethod();
   }
 
-  @Nullable
   @Override
-  public String url(@Nonnull Invocation invocation) {
+  public String path() {
+    return invocation.getOperationMeta().getOperationPath();
+  }
+
+  @Override
+  public String url() {
     return invocation.getEndpoint().getEndpoint();
   }
 
-  @Nullable
   @Override
-  public String path(@Nonnull Invocation request) {
-    return request.getOperationMeta().getOperationPath();
-  }
-
-  @Nullable
-  @Override
-  public String requestHeader(@Nonnull Invocation invocation, @Nonnull String key) {
+  public String header(String key) {
     return invocation.getContext().get(key);
   }
 
-  @Nullable
   @Override
-  public Integer statusCode(@Nonnull Response response) {
-    return response.getStatusCode();
+  public Object unwrap() {
+    return invocation;
   }
 }
diff --git a/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/HttpServerResponseWrapper.java b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/HttpServerResponseWrapper.java
new file mode 100644
index 0000000..ea01bea
--- /dev/null
+++ b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/HttpServerResponseWrapper.java
@@ -0,0 +1,78 @@
+/*
+ * 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.servicecomb.tracing.zipkin;
+
+import brave.http.HttpServerRequest;
+import brave.http.HttpServerResponse;
+import brave.internal.Nullable;
+
+import org.apache.servicecomb.swagger.invocation.Response;
+
+class HttpServerResponseWrapper extends HttpServerResponse {
+  @Nullable
+  private Response response;
+
+  @Nullable
+  private Throwable error;
+
+  @Nullable
+  private HttpServerRequest request;
+
+  HttpServerResponseWrapper() {
+  }
+
+  HttpServerResponseWrapper(Response response, Throwable error) {
+    this.response = response;
+    this.error = error;
+  }
+
+  HttpServerResponseWrapper response(Response response) {
+    this.response = response;
+    return this;
+  }
+
+  HttpServerResponseWrapper request(HttpServerRequest request) {
+    this.request = request;
+    return this;
+  }
+
+  HttpServerResponseWrapper error(Throwable error) {
+    this.error = error;
+    return this;
+  }
+
+  @Override
+  public int statusCode() {
+    return response.getStatusCode();
+  }
+
+  @Override
+  public Object unwrap() {
+    return response;
+  }
+
+  @Override
+  public HttpServerRequest request() {
+    return request;
+  }
+
+  @Override
+  public Throwable error() {
+    return error;
+  }
+}
diff --git a/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/TracingConfiguration.java b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/TracingConfiguration.java
index 9f0c1a8..3665dd8 100644
--- a/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/TracingConfiguration.java
+++ b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/TracingConfiguration.java
@@ -41,6 +41,7 @@
 import zipkin2.reporter.AsyncReporter;
 import zipkin2.reporter.Reporter;
 import zipkin2.reporter.Sender;
+import zipkin2.reporter.brave.AsyncZipkinSpanHandler;
 import zipkin2.reporter.okhttp3.OkHttpSender;
 
 @Configuration
@@ -59,8 +60,8 @@
     String path = MessageFormat.format(CONFIG_TRACING_COLLECTOR_PATH, apiVersion);
     return OkHttpSender.create(
         dynamicProperties.getStringProperty(
-            CONFIG_TRACING_COLLECTOR_ADDRESS,
-            DEFAULT_TRACING_COLLECTOR_ADDRESS)
+                CONFIG_TRACING_COLLECTOR_ADDRESS,
+                DEFAULT_TRACING_COLLECTOR_ADDRESS)
             .trim()
             .replaceAll("/+$", "")
             .concat(path));
@@ -77,18 +78,19 @@
 
 
   @Bean
-  Tracing tracing(Reporter<Span> reporter, DynamicProperties dynamicProperties,
+  Tracing tracing(Sender sender, DynamicProperties dynamicProperties,
       CurrentTraceContext currentTraceContext) {
     return Tracing.newBuilder()
         .localServiceName(BootStrapProperties.readServiceName())
         .currentTraceContext(currentTraceContext) // puts trace IDs into logs
-        .spanReporter(reporter)
+        .addSpanHandler(AsyncZipkinSpanHandler.create(sender))
         .build();
   }
 
   @Bean
   CurrentTraceContext currentTraceContext() {
-    return ThreadLocalCurrentTraceContext.newBuilder().addScopeDecorator(MDCScopeDecorator.create()).build();
+    return ThreadLocalCurrentTraceContext.newBuilder().addScopeDecorator(MDCScopeDecorator.newBuilder().build())
+        .build();
   }
 
   @Bean
diff --git a/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ZipkinConsumerDelegate.java b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ZipkinConsumerDelegate.java
index 13ca8fe..149dc8c 100644
--- a/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ZipkinConsumerDelegate.java
+++ b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ZipkinConsumerDelegate.java
@@ -22,6 +22,8 @@
 
 import brave.Span;
 import brave.Tracing;
+import brave.http.HttpClientRequest;
+import brave.http.HttpClientResponse;
 import brave.http.HttpClientHandler;
 import brave.http.HttpTracing;
 import brave.propagation.Propagation.Setter;
@@ -29,27 +31,32 @@
 
 class ZipkinConsumerDelegate implements ZipkinTracingDelegate {
 
-  private final HttpClientHandler<Invocation, Response> handler;
+  private final HttpClientHandler<HttpClientRequest, HttpClientResponse> handler;
 
   private final HttpTracing httpTracing;
 
   private final Injector<Invocation> injector;
 
-  @SuppressWarnings("unchecked")
+  private final HttpClientResponseWrapper responseWrapper;
+
+  private final HttpClientRequestWrapper requestWrapper;
+
   ZipkinConsumerDelegate(HttpTracing httpTracing) {
     this.httpTracing = httpTracing;
     this.injector = httpTracing.tracing().propagation().injector(injector());
-    this.handler = HttpClientHandler.create(httpTracing, new ConsumerInvocationAdapter());
+    this.handler = HttpClientHandler.create(httpTracing);
+    this.responseWrapper = new HttpClientResponseWrapper();
+    this.requestWrapper = new HttpClientRequestWrapper();
   }
 
   @Override
   public Span createSpan(Invocation invocation) {
-    return handler.handleSend(injector, invocation);
+    return handler.handleSend(requestWrapper.invocation(invocation));
   }
 
   @Override
   public void onResponse(Span span, Response response, Throwable error) {
-    handler.handleReceive(response, error, span);
+    handler.handleReceive(responseWrapper.response(response).throwable(error).request(requestWrapper), span);
   }
 
   @Override
diff --git a/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ZipkinProviderDelegate.java b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ZipkinProviderDelegate.java
index 9a8a58e..c0ff439 100644
--- a/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ZipkinProviderDelegate.java
+++ b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ZipkinProviderDelegate.java
@@ -26,6 +26,8 @@
 
 import brave.Span;
 import brave.Tracing;
+import brave.http.HttpServerRequest;
+import brave.http.HttpServerResponse;
 import brave.http.HttpServerHandler;
 import brave.http.HttpTracing;
 import brave.propagation.Propagation.Getter;
@@ -34,12 +36,16 @@
 class ZipkinProviderDelegate implements ZipkinTracingDelegate {
   private static final Logger LOG = LoggerFactory.getLogger(ZipkinProviderDelegate.class);
 
-  private final HttpServerHandler<Invocation, Response> handler;
+  private final HttpServerHandler<HttpServerRequest, HttpServerResponse> handler;
 
   private final HttpTracing httpTracing;
 
   private final Extractor<Invocation> extractor;
 
+  private final HttpServeRequestWrapper requestWrapper;
+
+  private final HttpServerResponseWrapper responseWrapper;
+
   public static final String SPAN_ID_HEADER_NAME = "X-B3-SpanId";
 
   public static final String TRACE_ID_HEADER_NAME = Const.TRACE_ID_NAME;
@@ -54,11 +60,12 @@
     return extracted;
   };
 
-  @SuppressWarnings("unchecked")
   ZipkinProviderDelegate(HttpTracing httpTracing) {
     this.httpTracing = httpTracing;
     this.extractor = httpTracing.tracing().propagation().extractor(extractor());
-    this.handler = HttpServerHandler.create(httpTracing, new ProviderInvocationAdapter());
+    this.handler = HttpServerHandler.create(httpTracing);
+    this.requestWrapper = new HttpServeRequestWrapper();
+    this.responseWrapper = new HttpServerResponseWrapper();
   }
 
   @Override
@@ -68,12 +75,12 @@
 
   @Override
   public Span createSpan(Invocation invocation) {
-    return handler.handleReceive(extractor, invocation);
+    return handler.handleReceive(requestWrapper.invocation(invocation));
   }
 
   @Override
   public void onResponse(Span span, Response response, Throwable error) {
-    handler.handleSend(response, error, span);
+    handler.handleSend(responseWrapper.response(response).error(error).request(requestWrapper), span);
   }
 
   @Override
diff --git a/integration-tests/test-common/src/test/java/org/apache/servicecomb/tests/tracing/TraceContextConfig.java b/integration-tests/test-common/src/test/java/org/apache/servicecomb/tests/tracing/TraceContextConfig.java
index d284c25..24b0009 100644
--- a/integration-tests/test-common/src/test/java/org/apache/servicecomb/tests/tracing/TraceContextConfig.java
+++ b/integration-tests/test-common/src/test/java/org/apache/servicecomb/tests/tracing/TraceContextConfig.java
@@ -22,7 +22,7 @@
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Primary;
 
-import brave.internal.HexCodec;
+import brave.internal.codec.HexCodec;
 import brave.propagation.CurrentTraceContext;
 import brave.propagation.TraceContext;
 
diff --git a/tracing/tracing-zipkin/src/test/java/org/apache/servicecomb/tracing/zipkin/ZipkinSpanAspectTest.java b/tracing/tracing-zipkin/src/test/java/org/apache/servicecomb/tracing/zipkin/ZipkinSpanAspectTest.java
index a909a7c..acccdc3 100644
--- a/tracing/tracing-zipkin/src/test/java/org/apache/servicecomb/tracing/zipkin/ZipkinSpanAspectTest.java
+++ b/tracing/tracing-zipkin/src/test/java/org/apache/servicecomb/tracing/zipkin/ZipkinSpanAspectTest.java
@@ -47,6 +47,7 @@
 import brave.propagation.StrictScopeDecorator;
 import brave.propagation.ThreadLocalCurrentTraceContext;
 import zipkin2.Span;
+import zipkin2.reporter.brave.ZipkinSpanHandler;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = {ZipkinSpanTestApplication.class, TracingConfig.class})
@@ -129,7 +130,7 @@
       return Tracing.newBuilder()
           .currentTraceContext(
               ThreadLocalCurrentTraceContext.newBuilder().addScopeDecorator(StrictScopeDecorator.create()).build())
-          .spanReporter(spans::add)
+          .addSpanHandler(ZipkinSpanHandler.create(spans::add))
           .build();
     }
   }
diff --git a/tracing/tracing-zipkin/src/test/java/org/apache/servicecomb/tracing/zipkin/ZipkinTracingAdviserTest.java b/tracing/tracing-zipkin/src/test/java/org/apache/servicecomb/tracing/zipkin/ZipkinTracingAdviserTest.java
index 604abc1..5b68f73 100644
--- a/tracing/tracing-zipkin/src/test/java/org/apache/servicecomb/tracing/zipkin/ZipkinTracingAdviserTest.java
+++ b/tracing/tracing-zipkin/src/test/java/org/apache/servicecomb/tracing/zipkin/ZipkinTracingAdviserTest.java
@@ -47,8 +47,11 @@
 import brave.Tracing;
 import brave.propagation.StrictScopeDecorator;
 import brave.propagation.ThreadLocalCurrentTraceContext;
+
 import org.junit.jupiter.api.Assertions;
 
+import zipkin2.reporter.brave.ZipkinSpanHandler;
+
 public class ZipkinTracingAdviserTest {
   private static final int nThreads = 10;
 
@@ -66,10 +69,10 @@
 
   private final Tracing tracing = Tracing.newBuilder()
       .currentTraceContext(
-          ThreadLocalCurrentTraceContext.newBuilder().addScopeDecorator(StrictScopeDecorator.create()).build()).
-          spanReporter(e -> traces.computeIfAbsent(e.traceId(), id -> new ConcurrentLinkedDeque<>()).
-              add(e)).
-          build();
+          ThreadLocalCurrentTraceContext.newBuilder().addScopeDecorator(StrictScopeDecorator.create()).build())
+      .addSpanHandler(ZipkinSpanHandler.create(
+          e -> traces.computeIfAbsent(e.traceId(), id -> new ConcurrentLinkedDeque<>()).add(e)))
+      .build();
 
   private final ZipkinTracingAdviser tracingAdviser = new ZipkinTracingAdviser(tracing.tracer());
 
@@ -105,7 +108,8 @@
 
     zipkin2.Span span = traces.values().iterator().next().poll();
     Assertions.assertEquals(spanName, span.name());
-    MatcherAssert.assertThat(tracedValues(span), containsInAnyOrder(this.getClass().getCanonicalName(), "RuntimeException: oops"));
+    MatcherAssert.assertThat(tracedValues(span),
+        containsInAnyOrder(this.getClass().getCanonicalName(), "RuntimeException: oops"));
   }
 
   @SuppressWarnings({"unused", "try"})