class SimpleSpanProcessor implements SpanProcessor {

  @Override
  public void onEnd(ReadableSpan span) {
    if (sampled && !span.getSpanContext().isSampled()) {
      return;
    }
    try {
      List<SpanData> spans = Collections.singletonList(span.toSpanData());
      final CompletableResultCode result = spanExporter.export(spans);
      result.whenComplete(
          new Runnable() {
            @Override
            public void run() {
              if (!result.isSuccess()) {
                logger.log(Level.FINE, "Exporter failed");
              }
            }
          });
    } catch (Exception e) {
      logger.log(Level.WARNING, "Exporter threw an Exception", e);
    }
  }

  private  SimpleSpanProcessor(SpanExporter spanExporter, boolean sampled);

}