use of brave.http.HttpRequest in project brave by openzipkin.
the class ITHttpServer method customSampler.
@Test
public void customSampler() throws IOException {
String path = "/foo";
SamplerFunction<HttpRequest> sampler = HttpRuleSampler.newBuilder().putRule(pathStartsWith(path), Sampler.NEVER_SAMPLE).build();
httpTracing = httpTracing.toBuilder().serverSampler(sampler).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
}
use of brave.http.HttpRequest in project brave by openzipkin.
the class ITHttpClient method customSampler.
@Test
public void customSampler() throws IOException {
String path = "/foo";
closeClient(client);
SamplerFunction<HttpRequest> sampler = HttpRuleSampler.newBuilder().putRule(pathStartsWith(path), Sampler.NEVER_SAMPLE).build();
httpTracing = httpTracing.toBuilder().clientSampler(sampler).build();
client = newClient(server.getPort());
server.enqueue(new MockResponse());
get(client, path);
assertThat(extract(takeRequest()).sampled()).isFalse();
}
Aggregations