대시보드 시스템 상태 카드에 메모리·디스크 신호등 추가
- Backend: PipelineMonitorService에 system 항목 추가 (OS 메모리, 디스크 사용률) - Frontend: SystemMonitorDto에 system 필드 추가 - DashboardPage: 시스템/메모리/디스크 3열 신호등 레이아웃 적용 - dashboardCommand.css: gc-dash-sys-status, gc-sys-tl-item 스타일 추가 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import com.goldenchart.websocket.UpbitWebSocketClient;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.MemoryMXBean;
|
||||
import java.lang.management.ThreadInfo;
|
||||
@@ -62,6 +63,7 @@ public class PipelineMonitorService {
|
||||
"gapBackfillCron", props.getGapBackfillCron()
|
||||
));
|
||||
out.put("jvm", jvmMetrics());
|
||||
out.put("system", systemMetrics());
|
||||
out.put("traffic", computeTrafficRates());
|
||||
out.put("memory", ta4jStorage.storageMetrics());
|
||||
out.put("queue", eventQueue.stats());
|
||||
@@ -91,6 +93,40 @@ public class PipelineMonitorService {
|
||||
return m;
|
||||
}
|
||||
|
||||
private Map<String, Object> systemMetrics() {
|
||||
Map<String, Object> m = new LinkedHashMap<>();
|
||||
// OS 물리 메모리
|
||||
try {
|
||||
com.sun.management.OperatingSystemMXBean osMx =
|
||||
(com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
|
||||
long totalPhys = osMx.getTotalMemorySize();
|
||||
long freePhys = osMx.getFreeMemorySize();
|
||||
double memPct = totalPhys > 0 ? (totalPhys - freePhys) * 100.0 / totalPhys : 0;
|
||||
m.put("osMemUsedMb", roundMb(totalPhys - freePhys));
|
||||
m.put("osMemTotalMb", roundMb(totalPhys));
|
||||
m.put("osMemPct", Math.round(memPct * 10) / 10.0);
|
||||
} catch (Exception e) {
|
||||
m.put("osMemUsedMb", 0);
|
||||
m.put("osMemTotalMb", 0);
|
||||
m.put("osMemPct", 0.0);
|
||||
}
|
||||
// 디스크 (루트 파티션)
|
||||
try {
|
||||
File root = new File("/");
|
||||
long total = root.getTotalSpace();
|
||||
long free = root.getFreeSpace();
|
||||
double diskPct = total > 0 ? (total - free) * 100.0 / total : 0;
|
||||
m.put("diskUsedGb", Math.round((total - free) / 1073741824.0 * 10) / 10.0);
|
||||
m.put("diskTotalGb", Math.round(total / 1073741824.0 * 10) / 10.0);
|
||||
m.put("diskPct", Math.round(diskPct * 10) / 10.0);
|
||||
} catch (Exception e) {
|
||||
m.put("diskUsedGb", 0.0);
|
||||
m.put("diskTotalGb", 0.0);
|
||||
m.put("diskPct", 0.0);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
private Map<String, Object> computeTrafficRates() {
|
||||
long now = System.currentTimeMillis();
|
||||
var q = eventQueue.stats();
|
||||
|
||||
Reference in New Issue
Block a user