@Override
  public byte[] shutdown() {
    try {
      rootSpan.end();
      myScope.close();
      if (myOpenTelemetry instanceof Closeable) {
        ((Closeable)myOpenTelemetry).close();
      }
      // the data should be exported only after OpenTelemetry was closed to prevent data loss
      Collection<SpanData> collectedSpans = mySpanDataCollector.getCollectedSpans();
      return MavenSpanDataSerializer.serialize(collectedSpans);
    }
    catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
@Override
  public byte[] shutdown()