You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zipkin.apache.org by ad...@apache.org on 2019/06/03 04:28:04 UTC

[incubator-zipkin-brave] branch master updated (4db98d3 -> a0f3525)

This is an automated email from the ASF dual-hosted git repository.

adriancole pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-zipkin-brave.git.


    from 4db98d3  RateLimitingSampler parallel theory didn't run by default (#888)
     new 2b19ec8  Backfills test of setNoop behavior
     new a0f3525  Makes soak test slightly tolerant

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 brave/src/test/java/brave/TracingTest.java         | 34 ++++++++++++++++++++--
 .../brave/sampler/RateLimitingSamplerSoakTest.java |  4 ++-
 2 files changed, 34 insertions(+), 4 deletions(-)


[incubator-zipkin-brave] 02/02: Makes soak test slightly tolerant

Posted by ad...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

adriancole pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-zipkin-brave.git

commit a0f352507612f3238bfa3e4df551a8d28d22e27c
Author: Adrian Cole <ac...@pivotal.io>
AuthorDate: Mon Jun 3 12:11:06 2019 +0800

    Makes soak test slightly tolerant
---
 brave/src/test/java/brave/sampler/RateLimitingSamplerSoakTest.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/brave/src/test/java/brave/sampler/RateLimitingSamplerSoakTest.java b/brave/src/test/java/brave/sampler/RateLimitingSamplerSoakTest.java
index bca68f1..b8fa32b 100644
--- a/brave/src/test/java/brave/sampler/RateLimitingSamplerSoakTest.java
+++ b/brave/src/test/java/brave/sampler/RateLimitingSamplerSoakTest.java
@@ -32,6 +32,7 @@ import org.junit.runner.RunWith;
 import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assumptions.assumeThat;
+import static org.assertj.core.data.Percentage.withPercentage;
 
 @RunWith(Theories.class)
 public class RateLimitingSamplerSoakTest {
@@ -80,7 +81,8 @@ public class RateLimitingSamplerSoakTest {
     service.shutdown();
     service.awaitTermination(1, TimeUnit.SECONDS);
 
-    assertThat(passed.get()).isEqualTo(reservoir);
+    assertThat(passed.get())
+        .isCloseTo(reservoir, withPercentage(0.01)); // accomodates flakes in CI
     assumeThat(hitLastDecisecond.get())
         .withFailMessage("ran out of samples before the end of the second")
         .isTrue();


[incubator-zipkin-brave] 01/02: Backfills test of setNoop behavior

Posted by ad...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

adriancole pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-zipkin-brave.git

commit 2b19ec8b79b6a48cca8d3cbf45eef4b13d373ae7
Author: Adrian Cole <ac...@pivotal.io>
AuthorDate: Tue Apr 23 08:24:46 2019 +0900

    Backfills test of setNoop behavior
---
 brave/src/test/java/brave/TracingTest.java | 34 +++++++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/brave/src/test/java/brave/TracingTest.java b/brave/src/test/java/brave/TracingTest.java
index a02fbff..39fedcd 100644
--- a/brave/src/test/java/brave/TracingTest.java
+++ b/brave/src/test/java/brave/TracingTest.java
@@ -41,6 +41,34 @@ public class TracingTest {
     }
   };
 
+  /**
+   * This behavior could be problematic as downstream services may report spans based on
+   * propagated sampled status, and be missing a parent when their parent tracer is in noop.
+   */
+  @Test public void setNoop_dropsDataButDoesntAffectSampling() {
+    try (Tracing tracing = Tracing.newBuilder().spanReporter(spans::add).build()) {
+      ScopedSpan parent = tracing.tracer().startScopedSpan("parent");
+
+      tracing.setNoop(true);
+
+      // a new child retains sampled from parent even in noop
+      brave.Span child = tracing.tracer().newChild(parent.context());
+      assertThat(child.context().sampled()).isTrue();
+      assertThat(child.isNoop()).isTrue();
+      child.finish();
+
+      parent.finish();
+
+      // a new trace is sampled from even when noop
+      brave.Span root = tracing.tracer().newTrace();
+      assertThat(root.context().sampled()).isTrue();
+      assertThat(root.isNoop()).isTrue();
+      root.finish();
+    }
+
+    assertThat(spans).isEmpty();
+  }
+
   @Test public void spanReporter_getsLocalEndpointInfo() {
     String expectedLocalServiceName = "favistar", expectedLocalIp = "1.2.3.4";
     int expectedLocalPort = 80;
@@ -116,9 +144,9 @@ public class TracingTest {
 
   @Test public void firehose_recordsWhenReporterIsNoopIfAlwaysSampleLocal() {
     try (Tracing tracing = Tracing.newBuilder()
-        .spanReporter(Reporter.NOOP)
-        .addFinishedSpanHandler(finishedSpanHandler)
-        .build()) {
+      .spanReporter(Reporter.NOOP)
+      .addFinishedSpanHandler(finishedSpanHandler)
+      .build()) {
       tracing.tracer().newTrace().start().name("aloha").finish();
     }