@Override
  protected void writeMetricsToIoTDB(Map<String, Map<String, Object>> valueMap, long time) {
    List<String> deviceIds = new ArrayList<>();
    List<Long> times = new ArrayList<>();
    List<List<String>> sensors = new ArrayList<>();
    List<List<TSDataType>> dataTypes = new ArrayList<>();
    List<List<Object>> values = new ArrayList<>();

    for (Map.Entry<String, Map<String, Object>> metric : valueMap.entrySet()) {
      deviceIds.add(metric.getKey());
      times.add(time);
      List<String> metricSensors = new ArrayList<>();
      List<TSDataType> metricDataTypes = new ArrayList<>();
      List<Object> metricValues = new ArrayList<>();
      for (Map.Entry<String, Object> sensor : metric.getValue().entrySet()) {
        metricSensors.add(sensor.getKey());
        metricDataTypes.add(inferType(sensor.getValue()));
        metricValues.add(sensor.getValue());
      }
      sensors.add(metricSensors);
      dataTypes.add(metricDataTypes);
      values.add(metricValues);
    }

    try {
      sessionPool.insertRecords(deviceIds, times, sensors, dataTypes, values);
    } catch (IoTDBConnectionException | StatementExecutionException e) {
      LOGGER.warn("IoTDBSessionReporter failed to insert record, because ", e);
    }
  }
The session pool to write metrics.
iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/reporter/iotdb/IoTDBSessionReporter.java