ref: 数据收集部分:批量数据上传时,对时间排序后再处理

dev-lensfrex
lensfrex 6 months ago
parent 3fb9308f95
commit 0ceb65be05
Signed by: lensfrex
GPG Key ID: B1E395B3C6CA0356
  1. 3
      rition-center/service/collector/src/main/java/rition/service/collector/MetricCollectingService.java

@ -61,7 +61,8 @@ public class MetricCollectingService {
public void receiveData(Map<Long, Map<String, MetricDataDto>> collectedMetricData) { public void receiveData(Map<Long, Map<String, MetricDataDto>> collectedMetricData) {
List<MetricRecordEntity> batchSaveEntityList = new ArrayList<>(DEFAULT_DB_BATCH_SIZE); List<MetricRecordEntity> batchSaveEntityList = new ArrayList<>(DEFAULT_DB_BATCH_SIZE);
int turn = 0; int turn = 0;
for (Long timestamp : collectedMetricData.keySet()) { List<Long> sortedTime = collectedMetricData.keySet().stream().sorted().toList();
for (Long timestamp : sortedTime) {
Map<String, MetricDataDto> instanceMetricData = collectedMetricData.get(timestamp); Map<String, MetricDataDto> instanceMetricData = collectedMetricData.get(timestamp);
for (String instanceId : instanceMetricData.keySet()) { for (String instanceId : instanceMetricData.keySet()) {
MetricDataDto metricDataDto = instanceMetricData.get(instanceId); MetricDataDto metricDataDto = instanceMetricData.get(instanceId);

Loading…
Cancel
Save