Span firstRemoteAncestor(SpanNode current) {
    SpanNode ancestor = current.parent();
    while (ancestor != null) {
      Span maybeRemote = ancestor.span();
      if (maybeRemote != null && maybeRemote.kind() != null) {
        if (logger.isLoggable(FINE)) logger.fine("found remote ancestor " + maybeRemote);
        return maybeRemote;
      }
      ancestor = ancestor.parent();
    }
    return null;
  }
All {@code spans} must have the same trace id.
zipkin/src/main/java/zipkin2/internal/DependencyLinker.java