public byte[] shutdown() {
    try {
      if (myScope != null) {
        myScope.close();
      }
      if (myOpenTelemetry instanceof Closeable) {
        ((Closeable)myOpenTelemetry).close();
      }
      // the data should be exported only after OpenTelemetry was closed to prevent data loss
      if (mySpanDataCollector != null) {
        Collection<SpanData> collectedSpans = mySpanDataCollector.getCollectedSpans();
        mySpanDataCollector.clear();
        return SpanDataSerializer.serialize(collectedSpans);
      }
    }
    catch (Exception e) {
      // ignore
    }
    return ArrayUtilRt.EMPTY_BYTE_ARRAY;
  }
public byte[] shutdown()