Class DurationSpanFilter

java.lang.Object
io.opentelemetry.contrib.filter.DurationSpanFilter
All Implemented Interfaces:
SpanFilter

public final class DurationSpanFilter extends Object implements SpanFilter
A SpanFilter that matches spans whose duration exceeds a configurable threshold, causing all batch-colocated spans sharing the same trace ID to be exported.
  • Constructor Details

    • DurationSpanFilter

      public DurationSpanFilter(Duration threshold)
      Creates a new DurationSpanFilter.
      Parameters:
      threshold - the duration threshold; spans with duration strictly greater than this are considered interesting
  • Method Details

    • shouldKeep

      public boolean shouldKeep(io.opentelemetry.sdk.trace.data.SpanData spanData)
      Description copied from interface: SpanFilter
      Evaluates whether the given span is interesting enough to keep its trace's spans in the batch.
      Specified by:
      shouldKeep in interface SpanFilter
      Parameters:
      spanData - the span to evaluate
      Returns:
      true if this span should cause its trace's batch-colocated spans to be exported