Skip to content

Commit

Permalink
[Framework] fix the error display in dashboard font-end and the log d…
Browse files Browse the repository at this point in the history
…ate in deploy.log (#441)
  • Loading branch information
dy247846795 authored Jan 15, 2025
1 parent d56afcc commit 92c85bd
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const LogTable: React.FC<{ componentName: string, agentUrl: string | undefined }
dataIndex: 'size',
sorter: (a, b) => sortTable(a.size, b.size),
render: (dom, entity) => {
return (formatFileSize(entity.size));
return (formatFileSize(entity?.size));
},
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ const MetricsChart: React.FC<{metrics: API.ProcessMetrics}> = ({metrics}) => {
<ProgressDiv
title='JVM Heap Memory'
percent={metrics?.heapUsedRatio}
description={metrics?.heapUsedMB + " / " + metrics.heapCommittedMB + " MB"}
description={metrics?.heapUsedMB + " / " + metrics?.heapCommittedMB + " MB"}
/>
<ProgressDiv
title='CPU Cores'
percent={metrics?.processCpu}
description={metrics?.usedCores + " / " + metrics.availCores + " Cores"}
description={metrics?.usedCores + " / " + metrics?.availCores + " Cores"}
/>
</div>
</ProCard>
Expand All @@ -61,21 +61,21 @@ const MetricsChart: React.FC<{metrics: API.ProcessMetrics}> = ({metrics}) => {
title: <FormattedMessage id="pages.processMetrics.totalMemoryMB" defaultMessage="Total" />,
dataIndex: 'totalMemoryMB',
render: (_, entity) => {
return entity.totalMemoryMB + " MB";
return entity?.totalMemoryMB + " MB";
},
},
{
title: <FormattedMessage id="pages.processMetrics.heapCommittedMB" defaultMessage="Heap Committed" />,
dataIndex: 'heapCommittedMB',
render: (_, entity) => {
return entity.heapCommittedMB + " MB";
return entity?.heapCommittedMB + " MB";
},
},
{
title: <FormattedMessage id="pages.processMetrics.heapUsedMB" defaultMessage="Heap Used" />,
dataIndex: 'heapUsedMB',
render: (_, entity) => {
return entity.heapUsedMB + " MB";
return entity?.heapUsedMB + " MB";
},
}
]
Expand All @@ -96,21 +96,21 @@ const MetricsChart: React.FC<{metrics: API.ProcessMetrics}> = ({metrics}) => {
title: <FormattedMessage id="pages.processMetrics.availCores" defaultMessage="availCores" />,
dataIndex: 'availCores',
render: (_, entity) => {
return entity.availCores;
return entity?.availCores;
},
},
{
title: <FormattedMessage id="pages.processMetrics.usedCores" defaultMessage="usedCores" />,
dataIndex: 'usedCores',
render: (_, entity) => {
return entity.usedCores;
return entity?.usedCores;
},
},
{
title: <FormattedMessage id="pages.processMetrics.activeThreads" defaultMessage="activeThreads" />,
dataIndex: 'activeThreads',
render: (_, entity) => {
return entity.activeThreads;
return entity?.activeThreads;
},
}
]
Expand All @@ -131,28 +131,28 @@ const MetricsChart: React.FC<{metrics: API.ProcessMetrics}> = ({metrics}) => {
title: <FormattedMessage id="pages.processMetrics.fgcCount" defaultMessage="fgcCount" />,
dataIndex: 'fgcCount',
render: (_, entity) => {
return entity.fgcCount;
return entity?.fgcCount;
},
},
{
title: <FormattedMessage id="pages.processMetrics.fgcTime" defaultMessage="fgcTime" />,
dataIndex: 'fgcTime',
render: (_, entity) => {
return entity.fgcTime;
return entity?.fgcTime;
},
},
{
title: <FormattedMessage id="pages.processMetrics.gcCount" defaultMessage="gcCount" />,
dataIndex: 'gcCount',
render: (_, entity) => {
return entity.gcCount;
return entity?.gcCount;
},
},
{
title: <FormattedMessage id="pages.processMetrics.gcTime" defaultMessage="gcTime" />,
dataIndex: 'gcTime',
render: (_, entity) => {
return entity.gcTime;
return entity?.gcTime;
},
},
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const errorConfig: RequestConfig = {
},
// 错误接收及处理
errorHandler: (error: any, opts: any) => {
console.log(error);
if (opts?.skipErrorHandler) throw error;
// 我们的 errorThrower 抛出的错误。
if (error.name === 'BizError') {
Expand All @@ -49,7 +50,13 @@ export const errorConfig: RequestConfig = {
} else if (error.response) {
// Axios 的错误
// 请求成功发出且服务器也响应了状态码,但状态代码超出了 2xx 的范围
antdMessage.error(`Response status:${error.response.status}`);
let message: string;
if (typeof error.response.data == 'string') {
message = error.response.data;
} else {
message = error.response.data.message ?? error.response.data.data;
}
antdMessage.error(`Response status:${error.response.status}, message:${message}`);
} else if (error.request) {
// 请求已经成功发起,但没有收到响应
// \`error.request\` 在浏览器中是 XMLHttpRequest 的实例,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export async function cycleList(pipelineName?: string) {

export async function logList(agentUrl: string) {
return request<{
data: API.FileInfo[],
data?: API.FileInfo[],
success?: boolean,
message?: string
}>('/proxy/' + agentUrl + "/rest/logs", {
Expand All @@ -117,7 +117,7 @@ export async function getLogContent(agentUrl: string, logPath: string, pageNo: n

export async function flameGraphList(agentUrl: string) {
return request<{
data: API.FileInfo[],
data?: API.FileInfo[],
success?: boolean,
message?: string
}>('/proxy/' + agentUrl + "/rest/flame-graphs", {
Expand Down
2 changes: 1 addition & 1 deletion geaflow/geaflow-deploy/docker/udf-downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import time

def main(logFilePath, jarPath, jarUrlEnvName):
logging.basicConfig(filename=logFilePath, filemode="a", format="%(asctime)s %(name)s:%(levelname)s:%(message)s", datefmt="%Y-%M-%d %H:%M:%S", level=logging.DEBUG)
logging.basicConfig(filename=logFilePath, filemode="a", format="%(asctime)s %(name)s:%(levelname)s:%(message)s", datefmt="%Y-%m-%d %H:%M:%S", level=logging.DEBUG)
jarUrls = os.getenv(jarUrlEnvName)
if not jarUrls or not jarUrls.strip():
return
Expand Down

0 comments on commit 92c85bd

Please sign in to comment.