Class LinksBasedSampler

java.lang.Object
io.opentelemetry.contrib.sampler.LinksBasedSampler
All Implemented Interfaces:
io.opentelemetry.sdk.trace.samplers.Sampler, Closeable, AutoCloseable

public final class LinksBasedSampler extends Object implements io.opentelemetry.sdk.trace.samplers.Sampler
A Sampler that uses the sampled flag of the span links if present. If at least one span link is sampled, then this span will be sampled. Otherwise, it is not sampled. If the span has no span links, this Sampler will use the "root" sampler that it is built with.
  • Method Summary

    Modifier and Type
    Method
    Description
    create(io.opentelemetry.sdk.trace.samplers.Sampler root)
     
     
    io.opentelemetry.sdk.trace.samplers.SamplingResult
    shouldSample(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)
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.opentelemetry.sdk.trace.samplers.Sampler

    close, shutdown
  • Method Details

    • create

      public static LinksBasedSampler create(io.opentelemetry.sdk.trace.samplers.Sampler root)
    • shouldSample

      public io.opentelemetry.sdk.trace.samplers.SamplingResult shouldSample(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)
      Specified by:
      shouldSample in interface io.opentelemetry.sdk.trace.samplers.Sampler
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface io.opentelemetry.sdk.trace.samplers.Sampler
    • toString

      public String toString()
      Overrides:
      toString in class Object