class TracezDataAggregator {

  List<SpanData> getErrorSpans(String spanName) {
    Map<String, TracezSpanBuckets> completedSpanCache = spanProcessor.getCompletedSpanCache();
    TracezSpanBuckets buckets = completedSpanCache.get(spanName);
    if (buckets == null) {
      return Collections.emptyList();
    }
    Collection<ReadableSpan> allErrorSpans = buckets.getErrorSpans();
    List<SpanData> errorSpans = new ArrayList<>();
    for (ReadableSpan span : allErrorSpans) {
      errorSpans.add(span.toSpanData());
    }
    return Collections.unmodifiableList(errorSpans);
  }

    TracezDataAggregator(TracezSpanProcessor spanProcessor);

}