Tabnine Logo
HttpRuleSampler
Code IndexAdd Tabnine to your IDE (free)

How to use
HttpRuleSampler
in
brave.http

Best Java code snippets using brave.http.HttpRuleSampler (Showing top 5 results out of 315)

origin: openzipkin/brave

public HttpSampler build() {
 return new HttpRuleSampler(rules);
}
origin: openzipkin/brave

@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
}
origin: openzipkin/brave

@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"));
}
origin: io.zipkin.brave/brave-instrumentation-http-tests

@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
}
origin: io.zipkin.brave/brave-instrumentation-http-tests

@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"));
}
brave.httpHttpRuleSampler

Javadoc

Assigns sample rates to http routes.

Ex. Here's a sampler that traces 80% requests to /foo and 10% of POST requests to /bar. Other requests will use a global rate provided by the Tracing.

 
httpTracingBuilder.serverSampler(HttpRuleSampler.newBuilder()

Note that the path is a prefix, so "/foo" will match "/foo/abcd".

Most used methods

  • <init>
  • newBuilder

Popular in Java

  • Reactive rest calls using spring rest template
  • requestLocationUpdates (LocationManager)
  • startActivity (Activity)
  • getResourceAsStream (ClassLoader)
  • Kernel (java.awt.image)
  • Permission (java.security)
    Legacy security code; do not use.
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now