You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2018/01/17 13:46:52 UTC

[GitHub] reta closed pull request #367: [CXF-7608] Propagate trace ids as it lets log correlation to be consi?

reta closed pull request #367: [CXF-7608] Propagate trace ids as it lets log correlation to be consi?
URL: https://github.com/apache/cxf/pull/367
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 bd208f2cd58..7bc4bcbae6a 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
@@ -66,7 +66,7 @@ public AbstractBraveClientProvider(final HttpTracing brave) {
         // 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.
         SpanInScope scope = null;
-        if (!isAsyncInvocation() && span != null && !span.isNoop()) {
+        if (!isAsyncInvocation() && span != null) {
             scope = brave.tracing().tracer().withSpanInScope(span);
         }
 
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 46d986295dd..aff576d3994 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
@@ -69,7 +69,7 @@ protected AbstractBraveProvider(final HttpTracing brave) {
         if (isAsyncResponse() && span != null) {
            // Do not modify the current context span
             propagateContinuationSpan(span);
-        } else if (span != null && !span.isNoop()) {
+        } else if (span != null) {
             scope = brave.tracing().tracer().withSpanInScope(span);
         }
 
diff --git a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/BraveTracingTest.java b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/BraveTracingTest.java
index 5bdf9bb31a3..d972d6d9f03 100644
--- a/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/BraveTracingTest.java
+++ b/systests/tracing/src/test/java/org/apache/cxf/systest/jaxrs/tracing/brave/BraveTracingTest.java
@@ -373,6 +373,21 @@ public void testThatInnerSpanIsCreatedUsingPseudoAsyncInvocation() {
         assertThatTraceIsPresent(r, spanId);
     }
 
+    @Test
+    public void testThatNoSpansAreRecordedWhenNotSampled() {
+        final Tracing never = Tracing
+                .newBuilder()
+                .reporter(new TestSpanReporter())
+                .sampler(Sampler.NEVER_SAMPLE)
+                .build();
+
+        final Response r = createWebClient("/bookstore/books", new BraveClientProvider(never)).get();
+        assertEquals(Status.OK.getStatusCode(), r.getStatus());
+
+        assertThat(TestSpanReporter.getAllSpans().size(), equalTo(0));
+        assertThatTraceHeadersArePresent(r, false);
+    }
+
     protected WebClient createWebClient(final String url, final Object ... providers) {
         return WebClient
             .create("http://localhost:" + PORT + url, Arrays.asList(providers))


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services