Skip to content

Commit

Permalink
feat: update service monitor overview (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
xigongdaEricyang authored Apr 7, 2023
1 parent c53750e commit 66c57db
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/config/locale/en-US/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/config/locale/zh-CN/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "磁盘写入",
Expand Down
2 changes: 1 addition & 1 deletion src/config/locale/zh-CN/metric_description.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 数值相关",
Expand Down
4 changes: 2 additions & 2 deletions src/pages/ServiceDashboard/OverviewTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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}`,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ServiceDashboard/ServiceOverview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}}`;
}
Expand Down
10 changes: 5 additions & 5 deletions src/utils/promQL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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`,
}
]
},
Expand Down

0 comments on commit 66c57db

Please sign in to comment.