Package brave.sampler
Class SamplerFunctions
- java.lang.Object
-
- brave.sampler.SamplerFunctions
-
public final class SamplerFunctions extends Object
Convenience sampling functions.- Since:
- 5.8
- See Also:
SamplerFunction
-
-
Constructor Summary
Constructors Constructor Description SamplerFunctions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> SamplerFunction<T>
deferDecision()
Ignores the argument and returns null.static <T> SamplerFunction<T>
neverSample()
Ignores the argument and returns false.static <T> SamplerFunction<T>
nullSafe(SamplerFunction<T> delegate)
Returns a function that returns null on null input instead of invoking the delegate with null.
-
-
-
Method Detail
-
nullSafe
public static <T> SamplerFunction<T> nullSafe(SamplerFunction<T> delegate)
Returns a function that returns null on null input instead of invoking the delegate with null.- Since:
- 5.8
-
deferDecision
public static <T> SamplerFunction<T> deferDecision()
Ignores the argument and returns null. This is typically used to defer to thetrace ID sampler
.- Since:
- 5.8
-
neverSample
public static <T> SamplerFunction<T> neverSample()
Ignores the argument and returns false. This means it will never start new traces.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.
- Since:
- 5.8
-
-