Package brave.sampler
Interface SamplerFunction<T>
-
- Type Parameters:
T
- type of the input, for example a request or method
- All Known Implementing Classes:
DeclarativeSampler
,ParameterizedSampler
public interface SamplerFunction<T>
Decides whether to start a new trace based on request properties such as an HTTP path.Ex. Here's a sampler that only traces api requests
{@code serverSampler = new SamplerFunction
() { - Since:
- 5.8
- See Also:
SamplerFunctions
,Request
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Boolean
trySample(T arg)
Returns an overriding sampling decision for a new trace.
-
-
-
Method Detail
-
trySample
@Nullable Boolean trySample(@Nullable T arg)
Returns an overriding sampling decision for a new trace. Returning null is typically used to defer to thetrace ID sampler
.- Parameters:
arg
- parameter to evaluate for a sampling decision. null input results in a null result- Returns:
- true to sample a new trace or false to deny. Null defers the decision.
- Since:
- 5.8
-
-