feature(web): 增加压缩结果显示

This commit is contained in:
2023-06-14 17:20:47 +08:00
parent 6abbd3d46a
commit 29c328a899
6 changed files with 212 additions and 17 deletions

View File

@@ -18,7 +18,8 @@ public class CompactionMetricsVO {
private final Boolean complete;
private final Long startedTime;
private final Long finishedTime;
private final StatisticsVO before;
private final StatisticsVO after;
private String startedTimeFromNow;
private String finishedTimeFromNow;
@@ -32,6 +33,8 @@ public class CompactionMetricsVO {
this.complete = metrics.getComplete();
this.startedTime = metrics.getStartedTime();
this.finishedTime = metrics.getFinishedTime();
this.before = new StatisticsVO(metrics.getBefore());
this.after = new StatisticsVO(metrics.getAfter());
long now = Instant.now().toEpochMilli();
if (ObjectUtil.isNotNull(metrics.getStartedTime()) && metrics.getStartedTime() != 0) {
@@ -74,6 +77,14 @@ public class CompactionMetricsVO {
return finishedTime;
}
public StatisticsVO getBefore() {
return before;
}
public StatisticsVO getAfter() {
return after;
}
public String getStartedTimeFromNow() {
return startedTimeFromNow;
}
@@ -81,4 +92,55 @@ public class CompactionMetricsVO {
public String getFinishedTimeFromNow() {
return finishedTimeFromNow;
}
public static class StatisticsVO {
private final String totalScanTime;
private final String totalLogFilesCompacted;
private final String totalLogFilesSize;
private final String totalRecordsDeleted;
private final String totalRecordsUpdated;
private final String totalRecordsCompacted;
public StatisticsVO(CompactionMetrics.Statistics statistics) {
if (statistics == null) {
this.totalScanTime = null;
this.totalLogFilesCompacted = null;
this.totalLogFilesSize = null;
this.totalRecordsDeleted = null;
this.totalRecordsUpdated = null;
this.totalRecordsCompacted = null;
return;
}
this.totalScanTime = statistics.getTotalScanTime() == null ? null : statistics.getTotalScanTime().toString();
this.totalLogFilesCompacted = statistics.getTotalLogFilesCompacted() == null ? null : statistics.getTotalLogFilesCompacted().toString();
this.totalLogFilesSize = statistics.getTotalLogFilesSize() == null ? null : statistics.getTotalLogFilesSize().toString();
this.totalRecordsDeleted = statistics.getTotalRecordsDeleted() == null ? null : statistics.getTotalRecordsDeleted().toString();
this.totalRecordsUpdated = statistics.getTotalRecordsUpdated() == null ? null : statistics.getTotalRecordsUpdated().toString();
this.totalRecordsCompacted = statistics.getTotalRecordsCompacted() == null ? null : statistics.getTotalRecordsCompacted().toString();
}
public String getTotalScanTime() {
return totalScanTime;
}
public String getTotalLogFilesCompacted() {
return totalLogFilesCompacted;
}
public String getTotalLogFilesSize() {
return totalLogFilesSize;
}
public String getTotalRecordsDeleted() {
return totalRecordsDeleted;
}
public String getTotalRecordsUpdated() {
return totalRecordsUpdated;
}
public String getTotalRecordsCompacted() {
return totalRecordsCompacted;
}
}
}