Package brave.http
Class HttpSampler
- java.lang.Object
-
- brave.http.HttpSampler
-
- Direct Known Subclasses:
HttpRuleSampler
public abstract class HttpSampler extends Object
Decides whether to start a new trace based on http request properties such as path.Ex. Here's a sampler that only traces api requests
{@code httpTracingBuilder.serverSampler(new HttpSampler() {- See Also:
HttpRuleSampler
-
-
Field Summary
Fields Modifier and Type Field Description static HttpSamplerNEVER_SAMPLEReturns false to never start new traces for http requests.static HttpSamplerTRACE_IDIgnores the request and uses thetrace ID instead.
-
Constructor Summary
Constructors Constructor Description HttpSampler()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract <Req> BooleantrySample(HttpAdapter<Req,?> adapter, Req request)Returns an overriding sampling decision for a new trace.
-
-
-
Field Detail
-
TRACE_ID
public static final HttpSampler TRACE_ID
Ignores the request and uses thetrace ID instead.
-
NEVER_SAMPLE
public static final HttpSampler NEVER_SAMPLE
Returns false to never start new traces for http requests. For example, you may wish to only capture traces if they originated from an inbound server request. Such a policy would filter out client requests made during bootstrap.
-
-
Method Detail
-
trySample
@Nullable public abstract <Req> Boolean trySample(HttpAdapter<Req,?> adapter, Req request)
Returns an overriding sampling decision for a new trace. Return null ignore the request and use thetrace ID sampler.
-
-