code: @Override
      public int exportCollectedMetrics() {
          if(queryResults.isEmpty()) {
              return 0;
          }
  
          int totalExportedMetricsCount = 0;
          long nanosBefore = System.nanoTime();
  
          List<OutputWriter> effectiveOutputWriters = getEffectiveOutputWriters();
          int exportBatchSize = getEmbeddedJmxTrans().getExportBatchSize();
          List<QueryResult> availableQueryResults = new ArrayList<QueryResult>(exportBatchSize);
  
          int size;
          while ((size = queryResults.drainTo(availableQueryResults, exportBatchSize)) > 0) {
              totalExportedMetricsCount += size;
              exportedMetricsCount.addAndGet(size);
              for (OutputWriter outputWriter : effectiveOutputWriters) {
                  outputWriter.write(availableQueryResults);
              }
              availableQueryResults.clear();
          }
          exportDurationInNanos.addAndGet(System.nanoTime() - nanosBefore);
          exportCount.incrementAndGet();
          return totalExportedMetricsCount;
      }
docs: Export the collected metrics to the {@linkplain OutputWriter}s associated with this {@linkplain Query}
  (see {@link #getEffectiveOutputWriters()}).
  
  Metrics are batched according to {@link EmbeddedJmxTrans#getExportBatchSize()}
  
  @return the number of exported {@linkplain QueryResult}