Skip to content

Commit

Permalink
tweak: change time range by cluster type (#1486)
Browse files Browse the repository at this point in the history
      * tweak: change time range by cluster type

* fix typo
  • Loading branch information
shhdgit authored Feb 16, 2023
1 parent 2052b4f commit 54ad7ea
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 24 deletions.
74 changes: 50 additions & 24 deletions ui/packages/tidb-dashboard-for-dbaas/src/apps/Monitoring/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,32 +44,58 @@ class DataSource implements IMonitoringDataSource {
}
}

const RECENT_SECONDS = [
5 * 60,
15 * 60,
30 * 60,
60 * 60,
3 * 60 * 60,
6 * 60 * 60,
12 * 60 * 60,
24 * 60 * 60,
7 * 24 * 60 * 60
]

export const ctx: (globalConfig: IGlobalConfig) => IMonitoringContext = (
globalConfig
) => ({
ds: new DataSource(globalConfig),
cfg: {
getMetricsQueries: (pdVersion: string | undefined) =>
getMonitoringItems(pdVersion, globalConfig.clusterInfo.deployType),
timeRangeSelector: {
recent_seconds: RECENT_SECONDS,
customAbsoluteRangePicker: true
},
metricsReferenceLink:
globalConfig.clusterInfo.deployType === 'Dedicated'
) => {
const isDedicated = globalConfig.clusterInfo.deployType === 'Dedicated'
const RECENT_SECONDS = globalConfig.expandMetricsData
? isDedicated
? [
5 * 60,
15 * 60,
30 * 60,
60 * 60,
3 * 60 * 60,
12 * 60 * 60,
24 * 60 * 60,
3 * 24 * 60 * 60,
7 * 24 * 60 * 60
]
: [
5 * 60,
15 * 60,
30 * 60,
60 * 60,
3 * 60 * 60,
12 * 60 * 60,
24 * 60 * 60,
2 * 24 * 60 * 60,
3 * 24 * 60 * 60
]
: [
5 * 60,
15 * 60,
30 * 60,
60 * 60,
3 * 60 * 60,
6 * 60 * 60,
12 * 60 * 60,
24 * 60 * 60,
2 * 24 * 60 * 60
]

return {
ds: new DataSource(globalConfig),
cfg: {
getMetricsQueries: (pdVersion: string | undefined) =>
getMonitoringItems(pdVersion, globalConfig.clusterInfo.deployType),
timeRangeSelector: {
recent_seconds: RECENT_SECONDS,
customAbsoluteRangePicker: true
},
metricsReferenceLink: isDedicated
? 'https://docs.pingcap.com/tidbcloud/built-in-monitoring'
: ''
}
}
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export interface IGlobalConfig {
timezone: number | null
promBaseUrl: string

expandMetricsData: boolean

clusterInfo: {
orgId: string
tenantPlan: string // FREE_TRIAL / POC / ON_DEMAND
Expand Down

0 comments on commit 54ad7ea

Please sign in to comment.