@Test public void customSampler() throws Exception { String path = "/foo"; httpTracing = httpTracing.toBuilder().serverSampler(HttpRuleSampler.newBuilder() .addRule(null, path, 0.0f) .build()).build(); init(); Request request = new Request.Builder().url(url(path)).build(); try (Response response = client.newCall(request).execute()) { assertThat(response.isSuccessful()).isTrue(); } // @After will check that nothing is reported }
@Test public void customSampler() throws Exception { close(); httpTracing = httpTracing.toBuilder().clientSampler(HttpRuleSampler.newBuilder() .addRule(null, "/foo", 0.0f) .build()).build(); client = newClient(server.getPort()); server.enqueue(new MockResponse()); get(client, "/foo"); RecordedRequest request = server.takeRequest(); assertThat(request.getHeaders().toMultimap()) .containsEntry("x-b3-sampled", asList("0")); }
@Test public void customSampler() throws Exception { String path = "/foo"; httpTracing = httpTracing.toBuilder().serverSampler(HttpRuleSampler.newBuilder() .addRule(null, path, 0.0f) .build()).build(); init(); Request request = new Request.Builder().url(url(path)).build(); try (Response response = client.newCall(request).execute()) { assertThat(response.isSuccessful()).isTrue(); } // @After will check that nothing is reported }
@Test public void customSampler() throws Exception { close(); httpTracing = httpTracing.toBuilder().clientSampler(HttpRuleSampler.newBuilder() .addRule(null, "/foo", 0.0f) .build()).build(); client = newClient(server.getPort()); server.enqueue(new MockResponse()); get(client, "/foo"); RecordedRequest request = server.takeRequest(); assertThat(request.getHeaders().toMultimap()) .containsEntry("x-b3-sampled", asList("0")); }