Interface SamplingPredicate

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface SamplingPredicate
A predicate for a composable sampler, indicating whether a set of sampling arguments matches.

While this can be implemented with lambda expressions, it is recommended to implement Object.toString() as well with an explanation of the predicate for rendering in Sampler.getDescription().

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    matches(io.opentelemetry.context.Context parentContext, String traceId, String name, io.opentelemetry.api.trace.SpanKind spanKind, io.opentelemetry.api.common.Attributes attributes, List<io.opentelemetry.sdk.trace.data.LinkData> parentLinks)
    Returns whether this SamplingPredicate matches the given sampling arguments.
  • Method Details

    • matches

      boolean matches(io.opentelemetry.context.Context parentContext, String traceId, String name, io.opentelemetry.api.trace.SpanKind spanKind, io.opentelemetry.api.common.Attributes attributes, List<io.opentelemetry.sdk.trace.data.LinkData> parentLinks)
      Returns whether this SamplingPredicate matches the given sampling arguments.