|
@@ -8,7 +8,7 @@ import com.clickhouse.client.api.enums.Protocol;
|
|
|
import com.clickhouse.client.api.metadata.TableSchema;
|
|
|
import com.clickhouse.client.api.query.QueryResponse;
|
|
|
import com.clickhouse.client.api.query.QuerySettings;
|
|
|
-import db.dto.ClickHousePointVal;
|
|
|
+import db.dto.StckPointVal;
|
|
|
import db.page.MultiPointRangePagingQuery;
|
|
|
import db.page.RangePagingQuery;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -22,7 +22,6 @@ import java.net.HttpURLConnection;
|
|
|
import java.net.URL;
|
|
|
import java.net.URLConnection;
|
|
|
import java.util.*;
|
|
|
-import java.util.function.Consumer;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
// TODO: Add log support
|
|
@@ -73,7 +72,7 @@ public class DBApiEntry implements AutoCloseable {
|
|
|
|
|
|
// Init ClickHouse client
|
|
|
TableSchema schema = client.getTableSchema(makeTableName(), currentDatabase);
|
|
|
- client.register(db.dto.ClickHousePointVal.class, schema);
|
|
|
+ client.register(StckPointVal.class, schema);
|
|
|
}
|
|
|
|
|
|
public DBApiEntry(String addressHost, int publicPort, String token) throws IOException {
|
|
@@ -447,7 +446,7 @@ public class DBApiEntry implements AutoCloseable {
|
|
|
pointVals.getPoint().ensureValid();
|
|
|
|
|
|
// Convert to ClickHousePointVal for insertion
|
|
|
- List<ClickHousePointVal> pointValsList = new LinkedList<>();
|
|
|
+ List<StckPointVal> pointValsList = new LinkedList<>();
|
|
|
String metricName = pointVals.getMetricName();
|
|
|
String pointName = pointVals.getPointName();
|
|
|
HashMap<String, String> tags = new HashMap<>();
|
|
@@ -458,13 +457,13 @@ public class DBApiEntry implements AutoCloseable {
|
|
|
tags.put(key, pointVals.getTags().get(key));
|
|
|
}
|
|
|
for (int i = 0; i < pointVals.getCount(); i++) {
|
|
|
- ClickHousePointVal clickHousePointVal = new ClickHousePointVal();
|
|
|
- clickHousePointVal.setMetricName(metricName);
|
|
|
- clickHousePointVal.setPointName(pointName);
|
|
|
- clickHousePointVal.setTags(tags);
|
|
|
- clickHousePointVal.setNanoseconds(pointVals.getUtcTime(i));
|
|
|
- clickHousePointVal.setValue(pointVals.getValue(i));
|
|
|
- pointValsList.add(clickHousePointVal);
|
|
|
+ StckPointVal stckPointVal = new StckPointVal();
|
|
|
+ stckPointVal.setMetricName(metricName);
|
|
|
+ stckPointVal.setPointName(pointName);
|
|
|
+ stckPointVal.setTags(tags);
|
|
|
+ stckPointVal.setNanoseconds(pointVals.getUtcTime(i));
|
|
|
+ stckPointVal.setValue(pointVals.getValue(i));
|
|
|
+ pointValsList.add(stckPointVal);
|
|
|
}
|
|
|
try {
|
|
|
client.insert(makeTableName(), pointValsList).get();
|
|
@@ -479,11 +478,11 @@ public class DBApiEntry implements AutoCloseable {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- List<ClickHousePointVal> pointValsList = new LinkedList<>();
|
|
|
+ List<StckPointVal> pointValsList = new LinkedList<>();
|
|
|
for (DBVal dbVal : dbVals) {
|
|
|
- ClickHousePointVal clickHousePointVal = new ClickHousePointVal();
|
|
|
- clickHousePointVal.setMetricName(dbVal.getMetricName());
|
|
|
- clickHousePointVal.setPointName(dbVal.getPointName());
|
|
|
+ StckPointVal stckPointVal = new StckPointVal();
|
|
|
+ stckPointVal.setMetricName(dbVal.getMetricName());
|
|
|
+ stckPointVal.setPointName(dbVal.getPointName());
|
|
|
HashMap<String, String> tags = new HashMap<>();
|
|
|
for (String key : dbVal.getTags().keySet()) {
|
|
|
if (StringUtils.equals(key, "pointName")) {
|
|
@@ -491,10 +490,10 @@ public class DBApiEntry implements AutoCloseable {
|
|
|
}
|
|
|
tags.put(key, dbVal.getTags().get(key));
|
|
|
}
|
|
|
- clickHousePointVal.setTags(tags);
|
|
|
- clickHousePointVal.setNanoseconds(dbVal.getUtcTimeMilliSeconds());
|
|
|
- clickHousePointVal.setValue(dbVal.getValue());
|
|
|
- pointValsList.add(clickHousePointVal);
|
|
|
+ stckPointVal.setTags(tags);
|
|
|
+ stckPointVal.setNanoseconds(dbVal.getUtcTimeMilliSeconds());
|
|
|
+ stckPointVal.setValue(dbVal.getValue());
|
|
|
+ pointValsList.add(stckPointVal);
|
|
|
}
|
|
|
try {
|
|
|
client.insert(makeTableName(), pointValsList).get();
|