private static void endSpan(CompletableFuture<?> future, Span span) {
    FutureUtils.addListener(future, (resp, error) -> {
      if (error != null) {
        setError(span, error);
      } else {
        span.setStatus(StatusCode.OK);
      }
      span.end();
    });
  }
Finish the {@code span} when the given {@code future} is completed.
hbase-common/src/main/java/org/apache/hadoop/hbase/trace/TraceUtil.java