Package brave.sampler

Class SamplerFunctions


  • public final class SamplerFunctions
    extends Object
    Convenience sampling functions.
    Since:
    5.8
    See Also:
    SamplerFunction
    • Constructor Detail

      • SamplerFunctions

        public SamplerFunctions()
    • 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 the trace 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