@Override
  @SuppressWarnings("unsafeThreadSchedule")
  public boolean start() {
    if (currentServiceFuture != null) {
      LOGGER.warn("IoTDBSessionReporter already start!");
      return false;
    }
    currentServiceFuture =
        service.scheduleAtFixedRate(
            () -> {
              try {
                Map<String, Map<String, Object>> values = new HashMap<>();
                for (Map.Entry<MetricInfo, IMetric> metricEntry :
                    metricManager.getAllMetrics().entrySet()) {
                  String prefix = IoTDBMetricsUtils.generatePath(metricEntry.getKey());
                  Map<String, Object> value = new HashMap<>();
                  metricEntry.getValue().constructValueMap(value);
                  values.put(prefix, value);
                }
                writeMetricsToIoTDB(values, System.currentTimeMillis());
              } catch (Throwable t) {
                LOGGER.error("IoTDBSessionReporter failed to start, because", t);
              }
            },
            1,
            MetricConfigDescriptor.getInstance().getMetricConfig().getAsyncCollectPeriodInSecond(),
            TimeUnit.SECONDS);
    LOGGER.info(
        "IoTDBSessionReporter start, write to {}:{}",
        ioTDBReporterConfig.getHost(),
        ioTDBReporterConfig.getPort());
    return true;
  }
The session pool to write metrics.
iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/reporter/iotdb/IoTDBSessionReporter.java