Package brave.http

Class 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 Detail

      • TRACE_ID

        public static final HttpSampler TRACE_ID
        Ignores the request and uses the trace 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.
    • Constructor Detail

      • HttpSampler

        public HttpSampler()
    • 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 the trace ID sampler.