private static void addParent(@NotNull Map<String, SpanData> target, @NotNull Map<String, SpanData> source, @NotNull String spanId) {
    if (!target.containsKey(spanId)) {
      SpanData span = source.get(spanId);
      if (span != null) {
        target.put(spanId, span);
        String parentSpanId = span.getParentSpanId();
        if (parentSpanId != null) {
          addParent(target, source, parentSpanId);
        }
      }
    }
  }
private static void addParent(@NotNull Map<String, SpanData> target, @NotNull Map<String, SpanData> source, @NotNull String spanId)