Merge release branch 4.17 to main

* 4.17:
  Use long instead of int in DB statistics for Queries and Uptime. (#7125)
  VR: fix public-key is missing in VR after acquiring public IP (#7103)
This commit is contained in:
Daan Hoogland 2023-01-26 09:59:36 +01:00
commit 46924a5782
4 changed files with 13 additions and 13 deletions

View File

@ -807,8 +807,8 @@ public class MetricsServiceImpl extends MutualExclusiveIdsManagerBase implements
private void getQueryHistory(DbMetricsResponse response) {
Map<String, Object> dbStats = ApiDBUtils.getDbStatistics();
if (dbStats != null) {
response.setQueries((Integer)dbStats.get(DbStatsCollection.queries));
response.setUptime((Integer)dbStats.get(DbStatsCollection.uptime));
response.setQueries((Long)dbStats.get(DbStatsCollection.queries));
response.setUptime((Long)dbStats.get(DbStatsCollection.uptime));
}
List<Double> loadHistory = (List<Double>) dbStats.get(DbStatsCollection.loadAvarages);

View File

@ -43,7 +43,7 @@ public class DbMetricsResponse extends BaseResponse {
@SerializedName(MetricConstants.UPTIME)
@Param(description = "the uptime of the DB in seconds")
private int uptime;
private long uptime;
@SerializedName(MetricConstants.TLS_VERSIONS)
@Param(description = "the tls versions currently in use (accepted) by the DB")
@ -59,7 +59,7 @@ public class DbMetricsResponse extends BaseResponse {
@SerializedName(MetricConstants.QUERIES)
@Param(description = "the number of queries performed on the DB")
private int queries;
private long queries;
@SerializedName(MetricConstants.DATABASE_LOAD_AVERAGES)
@Param(description = "the last measured load averages on the DB")
@ -77,7 +77,7 @@ public class DbMetricsResponse extends BaseResponse {
this.connections = connections;
}
public void setUptime(int uptime) {
public void setUptime(long uptime) {
this.uptime = uptime;
}
@ -93,7 +93,7 @@ public class DbMetricsResponse extends BaseResponse {
this.versionComment = versionComment;
}
public void setQueries(int queries) {
public void setQueries(long queries) {
this.queries = queries;
}

View File

@ -674,11 +674,11 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
LOGGER.debug(String.format("%s is running...", this.getClass().getSimpleName()));
try {
int lastUptime = (dbStats.containsKey(uptime) ? (Integer) dbStats.get(uptime) : 0);
int lastQueries = (dbStats.containsKey(queries) ? (Integer) dbStats.get(queries) : 0);
long lastUptime = (dbStats.containsKey(uptime) ? (Long) dbStats.get(uptime) : 0);
long lastQueries = (dbStats.containsKey(queries) ? (Long) dbStats.get(queries) : 0);
getDynamicDataFromDB();
int interval = (Integer) dbStats.get(uptime) - lastUptime;
int activity = (Integer) dbStats.get(queries) - lastQueries;
long interval = (Long) dbStats.get(uptime) - lastUptime;
long activity = (Long) dbStats.get(queries) - lastQueries;
loadHistory.add(0, Double.valueOf(activity / interval));
int maxsize = DATABASE_SERVER_LOAD_HISTORY_RETENTION_NUMBER.value();
while (loadHistory.size() > maxsize) {
@ -696,8 +696,8 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
private void getDynamicDataFromDB() {
Map<String, String> stats = DbUtil.getDbInfo("STATUS", queries, uptime);
dbStats.put(collectionTime, new Date());
dbStats.put(queries, (Integer.valueOf(stats.get(queries))));
dbStats.put(uptime, (Integer.valueOf(stats.get(uptime))));
dbStats.put(queries, (Long.valueOf(stats.get(queries))));
dbStats.put(uptime, (Long.valueOf(stats.get(uptime))));
}

View File

@ -254,7 +254,7 @@ public class BasicNetworkVisitor extends NetworkTopologyVisitor {
final NicVO nicVo = userdata.getNicVo();
final Commands commands = new Commands(Command.OnError.Stop);
_commandSetupHelper.createVmDataCommand(router, userVM, nicVo, null, commands);
_commandSetupHelper.createVmDataCommand(router, userVM, nicVo, userVM.getDetail("SSH.PublicKey"), commands);
return _networkGeneralHelper.sendCommandsToRouter(router, commands);
}