diff --git a/src/config/locale/en-US/device.json b/src/config/locale/en-US/device.json index 1dd3f159..d408f52e 100644 --- a/src/config/locale/en-US/device.json +++ b/src/config/locale/en-US/device.json @@ -49,7 +49,7 @@ "singleServiceTitle": "Single Service Monitor", "serviceName": "Service Name", "context_switches_total": "Context Switch", - "cpu_seconds_total": "CPU Seconds", + "cpu_seconds_total": "CPU Usage", "memory_bytes_gauge": "Memory Used", "read_bytes_total": "Read Bytes", "write_bytes_total": "Write Bytes", diff --git a/src/config/locale/zh-CN/device.json b/src/config/locale/zh-CN/device.json index 64624c38..ad4cc202 100644 --- a/src/config/locale/zh-CN/device.json +++ b/src/config/locale/zh-CN/device.json @@ -49,7 +49,7 @@ "singleServiceTitle": "单服务监控", "serviceName": "服务名", "context_switches_total": "上下文切换", - "cpu_seconds_total": "CPU使用时间", + "cpu_seconds_total": "CPU使用率", "memory_bytes_gauge": "内存使用量", "read_bytes_total": "磁盘读取", "write_bytes_total": "磁盘写入", diff --git a/src/config/locale/zh-CN/metric_description.json b/src/config/locale/zh-CN/metric_description.json index c5bd782f..9dac9818 100644 --- a/src/config/locale/zh-CN/metric_description.json +++ b/src/config/locale/zh-CN/metric_description.json @@ -164,7 +164,7 @@ "graphd_sessions": "Graphd Session", "process_memory": "进程内存使用", "process_disk": "进程磁盘读写", - "process_cpu": "进程CPU消耗", + "process_cpu": "进程CPU使用率", "process_context_open_file_desc": "进程上下文切换 & 文件句柄", "metad_latency": "Metad 延迟", "metad_nums": "Metad 数值相关", diff --git a/src/pages/ServiceDashboard/OverviewTable.tsx b/src/pages/ServiceDashboard/OverviewTable.tsx index 349de21b..0e82e3b4 100644 --- a/src/pages/ServiceDashboard/OverviewTable.tsx +++ b/src/pages/ServiceDashboard/OverviewTable.tsx @@ -107,7 +107,7 @@ function OverviewTable(props: IProps) { showText = text; break; case VALUE_TYPE.percentage: - showText = `${text}%`; + showText = `${parseFloat(text).toFixed(2)}%`; break; case VALUE_TYPE.byte: showText = getProperByteDesc(parseInt(text)).desc; @@ -196,7 +196,7 @@ function OverviewTable(props: IProps) { metrics.forEach((metric) => { let query = `nebula_${service}_${metric}${clusterSuffix1} - 0`; if (metric === 'cpu_seconds_total') { - query = `avg by (instanceName) (irate(nebula_${service}_${metric}${clusterSuffix1}[30s])) * 100` + query = `avg by (instanceName) (rate(nebula_${service}_${metric}${clusterSuffix1}[5m])) * 100` } queries.push({ refId: `${service}$${metric}`, diff --git a/src/pages/ServiceDashboard/ServiceOverview/index.tsx b/src/pages/ServiceDashboard/ServiceOverview/index.tsx index 82fc9235..f03aa653 100644 --- a/src/pages/ServiceDashboard/ServiceOverview/index.tsx +++ b/src/pages/ServiceDashboard/ServiceOverview/index.tsx @@ -111,7 +111,7 @@ function ServiceOverview(props: IProps) { query = `sum_over_time(${query}{instanceName="${curServiceName}"${clusterSuffix1}}[${15}s])`; } else { if (query.includes('cpu_seconds_total')) { - query = `avg by (instanceName) (irate(${query}{instanceName="${curServiceName}"${clusterSuffix1}}[30s])) * 100` + query = `avg by (instanceName) (rate(${query}{instanceName="${curServiceName}"${clusterSuffix1}}[5m])) * 100` } else { query = `${query}{instanceName="${curServiceName}"${clusterSuffix1}}`; } diff --git a/src/utils/promQL.ts b/src/utils/promQL.ts index 51175040..8e872f06 100644 --- a/src/utils/promQL.ts +++ b/src/utils/promQL.ts @@ -224,7 +224,7 @@ export let getNodeInfoQueries = (clusterId?) => { }, { refId: "cpuUtilization", - query: `(1 - avg(rate(node_cpu_seconds_total{mode="idle"${clusterSuffix1}}[30s])) by (instance)) * 100`, + query: `(1 - avg(rate(node_cpu_seconds_total{mode="idle"${clusterSuffix1}}[5m])) by (instance)) * 100`, }, { refId: "memoryUtilization", @@ -300,19 +300,19 @@ export const getMachineMetricData = (instance, cluster) => { queries: [ { refId: 'cpu_total_used', - query: `(1 - avg(irate(node_cpu_seconds_total{mode="idle"${clusterSuffix1},${instanceSuffix}}[30s])) by (instance))*100`, + query: `(1 - avg(rate(node_cpu_seconds_total{mode="idle"${clusterSuffix1},${instanceSuffix}}[5m])) by (instance))*100`, }, { refId: 'cpu_system_used', - query: `avg(irate(node_cpu_seconds_total{mode="system"${clusterSuffix1},${instanceSuffix}}[30s])) by (instance) *100`, + query: `avg(rate(node_cpu_seconds_total{mode="system"${clusterSuffix1},${instanceSuffix}}[5m])) by (instance) *100`, }, { refId: 'cpu_user_used', - query: `avg(irate(node_cpu_seconds_total{mode="user"${clusterSuffix1},${instanceSuffix}}[30s])) by (instance) *100`, + query: `avg(rate(node_cpu_seconds_total{mode="user"${clusterSuffix1},${instanceSuffix}}[5m])) by (instance) *100`, }, { refId: 'cpu_io_wait_used', - query: `avg(irate(node_cpu_seconds_total{mode="iowait"${clusterSuffix1},${instanceSuffix}}[30s])) by (instance) *100`, + query: `avg(rate(node_cpu_seconds_total{mode="iowait"${clusterSuffix1},${instanceSuffix}}[5m])) by (instance) *100`, } ] },