private static void render(final Consumer<String> writer, final Node node, final int indent,
    final boolean isFirst) {
    writer.accept(render(node.spanData, indent, isFirst));
    final List<Node> children = new ArrayList<>(node.children.values());
    for (ListIterator<Node> iter = children.listIterator(); iter.hasNext();) {
      final int idx = iter.nextIndex();
      final Node child = iter.next();
      render(writer, child, indent + 2, idx == 0);
    }
  }
A Rudimentary tool for visualizing a hierarchy of spans. Given a collection of spans, indexes
them from parents to children and prints them out one per line, indented.
hbase-client/src/test/java/org/apache/hadoop/hbase/client/trace/StringTraceRenderer.java