mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 08:03:13 +09:00
Rename SystemMetrics to SystemInfo
There are more pieces of information about a system than just its CPU, Memory and disk metrics. To avoid having to build a separate collection and subscription for metrics and system info, rename the existing system metrics to system info in anticipation of providing additonal static system information such as CPU model in it.
This commit is contained in:
1 parent
5f25aad273
commit
4e36fa1b4e
14 files changed
+128
-128
No files matched your search
@@ -2,7 +2,7 @@ import fs from "fs-extra";
|
||||
import os from "os";
|
||||
import util from "util";
|
||||
import { Gauge } from "./prometheus";
|
||||
import { SystemMetrics } from "./data";
|
||||
import { SystemInfo } from "./data";
|
||||
|
||||
function cpuModel() {
|
||||
const model = os.cpus()[0].model;
|
||||
@@ -133,7 +133,7 @@ function minZip<T>(a: T[], b: T[]): [T, T][] {
|
||||
|
||||
let previousTotalCpuMs: number[] = [];
|
||||
let previousIdleCpuMs: number[] = [];
|
||||
export async function gatherSystemMetrics(id: SystemMetrics["id"]) {
|
||||
export async function gatherSystemInfo(id: SystemInfo["id"]) {
|
||||
const cpus = os.cpus();
|
||||
const currentTotalCpuMs = cpus.map(({ times }) => times.user + times.idle + times.irq + times.nice + times.sys);
|
||||
const currentIdleCpuMs = cpus.map(({ times }) => times.idle);
|
||||
@@ -151,7 +151,7 @@ export async function gatherSystemMetrics(id: SystemMetrics["id"]) {
|
||||
diskAvailable = stats.bavail * stats.bsize;
|
||||
}
|
||||
|
||||
return new SystemMetrics(
|
||||
return new SystemInfo(
|
||||
id,
|
||||
cpuUsage,
|
||||
os.totalmem(),
|
||||
|
||||
Reference in new issue
Block a user