mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge remote-tracking branch 'origin/4.14'
This commit is contained in:
commit
c7328652fd
2
pom.xml
2
pom.xml
@ -134,7 +134,7 @@
|
|||||||
<cs.guava.version>28.2-jre</cs.guava.version>
|
<cs.guava.version>28.2-jre</cs.guava.version>
|
||||||
<cs.httpclient.version>4.5.11</cs.httpclient.version>
|
<cs.httpclient.version>4.5.11</cs.httpclient.version>
|
||||||
<cs.httpcore.version>4.4.13</cs.httpcore.version>
|
<cs.httpcore.version>4.4.13</cs.httpcore.version>
|
||||||
<cs.influxdb-java.version>2.17</cs.influxdb-java.version>
|
<cs.influxdb-java.version>2.20</cs.influxdb-java.version>
|
||||||
<cs.jackson.version>2.10.3</cs.jackson.version>
|
<cs.jackson.version>2.10.3</cs.jackson.version>
|
||||||
<cs.jasypt.version>1.9.3</cs.jasypt.version>
|
<cs.jasypt.version>1.9.3</cs.jasypt.version>
|
||||||
<cs.java-ipv6.version>0.17</cs.java-ipv6.version>
|
<cs.java-ipv6.version>0.17</cs.java-ipv6.version>
|
||||||
|
|||||||
@ -1336,21 +1336,25 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||||||
protected void sendMetricsToInfluxdb(Map<Object, Object> metrics) {
|
protected void sendMetricsToInfluxdb(Map<Object, Object> metrics) {
|
||||||
InfluxDB influxDbConnection = createInfluxDbConnection();
|
InfluxDB influxDbConnection = createInfluxDbConnection();
|
||||||
|
|
||||||
Pong response = influxDbConnection.ping();
|
try {
|
||||||
if (response.getVersion().equalsIgnoreCase("unknown")) {
|
Pong response = influxDbConnection.ping();
|
||||||
throw new CloudRuntimeException(String.format("Cannot ping influxdb host %s:%s.", externalStatsHost, externalStatsPort));
|
if (response.getVersion().equalsIgnoreCase("unknown")) {
|
||||||
|
throw new CloudRuntimeException(String.format("Cannot ping influxdb host %s:%s.", externalStatsHost, externalStatsPort));
|
||||||
|
}
|
||||||
|
|
||||||
|
Collection<Object> metricsObjects = metrics.values();
|
||||||
|
List<Point> points = new ArrayList<>();
|
||||||
|
|
||||||
|
s_logger.debug(String.format("Sending stats to %s host %s:%s", externalStatsType, externalStatsHost, externalStatsPort));
|
||||||
|
|
||||||
|
for (Object metricsObject : metricsObjects) {
|
||||||
|
Point vmPoint = creteInfluxDbPoint(metricsObject);
|
||||||
|
points.add(vmPoint);
|
||||||
|
}
|
||||||
|
writeBatches(influxDbConnection, databaseName, points);
|
||||||
|
} finally {
|
||||||
|
influxDbConnection.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection<Object> metricsObjects = metrics.values();
|
|
||||||
List<Point> points = new ArrayList<>();
|
|
||||||
|
|
||||||
s_logger.debug(String.format("Sending stats to %s host %s:%s", externalStatsType, externalStatsHost, externalStatsPort));
|
|
||||||
|
|
||||||
for (Object metricsObject : metricsObjects) {
|
|
||||||
Point vmPoint = creteInfluxDbPoint(metricsObject);
|
|
||||||
points.add(vmPoint);
|
|
||||||
}
|
|
||||||
writeBatches(influxDbConnection, databaseName, points);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1523,7 +1527,9 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||||||
*/
|
*/
|
||||||
protected void writeBatches(InfluxDB influxDbConnection, String dbName, List<Point> points) {
|
protected void writeBatches(InfluxDB influxDbConnection, String dbName, List<Point> points) {
|
||||||
BatchPoints batchPoints = BatchPoints.database(dbName).build();
|
BatchPoints batchPoints = BatchPoints.database(dbName).build();
|
||||||
influxDbConnection.enableBatch(BatchOptions.DEFAULTS);
|
if(!influxDbConnection.isBatchEnabled()){
|
||||||
|
influxDbConnection.enableBatch(BatchOptions.DEFAULTS);
|
||||||
|
}
|
||||||
|
|
||||||
for (Point point : points) {
|
for (Point point : points) {
|
||||||
batchPoints.point(point);
|
batchPoints.point(point);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user