Package brave.http
Class HttpRuleSampler
- java.lang.Object
-
- brave.http.HttpSampler
-
- brave.http.HttpRuleSampler
-
public final class HttpRuleSampler extends HttpSampler
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 component.httpTracingBuilder.serverSampler(HttpRuleSampler.newBuilder() .addRule(null, "/foo", 0.8f) .addRule("POST", "/bar", 0.1f) .build());Note that the path is a prefix, so "/foo" will match "/foo/abcd".
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHttpRuleSampler.Builder
-
Field Summary
-
Fields inherited from class brave.http.HttpSampler
NEVER_SAMPLE, TRACE_ID
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static HttpRuleSampler.BuildernewBuilder()<Req> BooleantrySample(HttpAdapter<Req,?> adapter, Req request)Returns an overriding sampling decision for a new trace.
-
-
-
Method Detail
-
newBuilder
public static HttpRuleSampler.Builder newBuilder()
-
trySample
public <Req> Boolean trySample(HttpAdapter<Req,?> adapter, Req request)
Description copied from class:HttpSamplerReturns an overriding sampling decision for a new trace. Return null ignore the request and use thetrace ID sampler.- Specified by:
trySamplein classHttpSampler
-
-