Package org.springframework.cloud.sleuth
Interface SamplerFunction<T>
-
- Type Parameters:
T
- type of the input, for example a request or method
- All Known Implementing Classes:
SamplerFunction.Constants
public interface SamplerFunction<T>
This API was heavily influenced by Brave. Parts of its documentation were taken directly from Brave. Decides whether to start a new trace based on request properties such as an HTTP path.- Since:
- 3.0.0
- Author:
- OpenZipkin Brave Authors, Marcin Grzejszczak
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
SamplerFunction.Constants
ConstantSamplerFunction
s.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static <T> SamplerFunction<T>
alwaysSample()
Always samplingSamplerFunction
.static <T> SamplerFunction<T>
deferDecision()
Always deferringSamplerFunction
.static <T> SamplerFunction<T>
neverSample()
Never samplingSamplerFunction
.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.- Parameters:
arg
- parameter to evaluate for a sampling decision.null
input results in anull
result- Returns:
true
to sample a new trace orfalse
to deny.null
defers the decision.
-
deferDecision
static <T> SamplerFunction<T> deferDecision()
Always deferringSamplerFunction
.- Type Parameters:
T
- type of the input, for example a request or method- Returns:
- decision deferring sampler function
-
neverSample
static <T> SamplerFunction<T> neverSample()
Never samplingSamplerFunction
.- Type Parameters:
T
- type of the input, for example a request or method- Returns:
- never sampling sampler function
-
alwaysSample
static <T> SamplerFunction<T> alwaysSample()
Always samplingSamplerFunction
.- Type Parameters:
T
- type of the input, for example a request or method- Returns:
- always sampling sampler function
-
-