server: use latest InfluxDB (2.15), add support to Batch Mode (#3289)

The InfluxDB Java client supports Batch Mode at versions 2.9+ [1]. Thus, this PR updated to the latest InfluxDB (2.15), adding support to Batch Mode

[1] https://github.com/influxdata/influxdb-java
This commit is contained in:
Gabriel Beims Bräscher 2019-04-29 15:05:37 -03:00 committed by Rohit Yadav
parent 89d548052b
commit d6437d5aca
3 changed files with 8 additions and 1 deletions

View File

@ -130,6 +130,7 @@
<cs.guava.version>23.6-jre</cs.guava.version>
<cs.httpclient.version>4.5.4</cs.httpclient.version>
<cs.httpcore.version>4.4.8</cs.httpcore.version>
<cs.influxdb-java.version>2.15</cs.influxdb-java.version>
<cs.jackson.version>2.9.2</cs.jackson.version>
<cs.jasypt.version>1.9.2</cs.jasypt.version>
<cs.java-ipv6.version>0.16</cs.java-ipv6.version>
@ -524,6 +525,11 @@
<artifactId>groovy-all</artifactId>
<version>${cs.groovy.version}</version>
</dependency>
<dependency>
<groupId>org.influxdb</groupId>
<artifactId>influxdb-java</artifactId>
<version>${cs.influxdb-java.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jmx</artifactId>

View File

@ -160,7 +160,6 @@
<dependency>
<groupId>org.influxdb</groupId>
<artifactId>influxdb-java</artifactId>
<version>2.8</version>
</dependency>
</dependencies>
<build>

View File

@ -51,6 +51,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.influxdb.BatchOptions;
import org.influxdb.InfluxDB;
import org.influxdb.InfluxDBFactory;
import org.influxdb.dto.BatchPoints;
@ -1502,6 +1503,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
*/
protected void writeBatches(InfluxDB influxDbConnection, String dbName, List<Point> points) {
BatchPoints batchPoints = BatchPoints.database(dbName).build();
influxDbConnection.enableBatch(BatchOptions.DEFAULTS);
for (Point point : points) {
batchPoints.point(point);