This commit is contained in:
Luoye_W 2021-08-03 16:47:18 +08:00
parent 9e3aeaac3c
commit 65b2ca6d6e

View File

@ -27,6 +27,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -89,15 +90,22 @@ public class OutlookLogController {
@GetMapping("/save") @GetMapping("/save")
public String save(){ public String save(){
Point point = Point.measurement("e5s") ArrayList<Point> arrayList = new ArrayList<>();
.addTag("githubud", "22121") for (int i = 0; i < 1000; i++) {
.addField("call_time", "11111") Point point = Point.measurement("e5s")
.addField("call_time2", "222222") .addTag("githubud", "22121")
.addField("call_time3", "3333333") .addField("aaaaaa1", i)
.time(Instant.now().toEpochMilli(), WritePrecision.MS); .addField("aaaaaa2", i)
.addField("aaaaaa3", i)
.time(Instant.now().toEpochMilli(), WritePrecision.MS);
arrayList.add(point);
}
try (WriteApi writeApi = influxDBClient.getWriteApi()) { try (WriteApi writeApi = influxDBClient.getWriteApi()) {
writeApi.writePoint(bucket, org, point); // writeApi.writePoint(bucket, org, point);
writeApi.writePoints(bucket,org, arrayList);
} }
return "ok"; return "ok";
} }