Skip to content

Commit

Permalink
Fetch statistic parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
yang1666204 authored Apr 7, 2024
1 parent c5df955 commit 79b6563
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
7 changes: 2 additions & 5 deletions ui/src/services/reportRequest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ type ReportMapType = {
[T: string]: { resourceType: ResourceType; eventType: EventType };
};

const REPORT_URL = 'http://openwebapi.test.alipay.net/api/web/oceanbase/report';
// const queryUrl = 'http://openwebapi.test.alipay.net/api/web/oceanbase/query';
const REPORT_COMPONENT = 'oceanbase-dashboard';
export const REPORT_PARAMS_MAP: ReportMapType = {
// polling
polling: {
Expand Down Expand Up @@ -143,7 +140,7 @@ export async function reportData({
}: ReportDataParms): Promise<any> {
const appInfo = await getAppInfoFromStorage();

return await request(REPORT_URL, {
return await request(`${appInfo.reportHost}/api/web/oceanbase/report`, {
method: 'POST',
data: {
content: JSON.stringify({
Expand All @@ -152,7 +149,7 @@ export async function reportData({
version: appInfo.version,
body: data,
}),
component: REPORT_COMPONENT,
component: appInfo.appName,
},
});
}
1 change: 1 addition & 0 deletions ui/src/services/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ declare namespace API {
publicKey: string;
reportStatistics: boolean;
version: string;
reportHost: string;
};

type SysStatisticsData = {
Expand Down
4 changes: 1 addition & 3 deletions ui/src/utils/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ export const getAppInfoFromStorage = async (): Promise<API.AppInfo> => {
appInfo = (await getAppInfo()).data;
}
return appInfo;
}catch(err){
throw new Error(err)
}
} catch (err) {}
};

export const isReportTimeExpired = (lastTimestamp: number): boolean => {
Expand Down

0 comments on commit 79b6563

Please sign in to comment.