Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: slow query and statements apps refines #1498

Merged
merged 8 commits into from
Mar 2, 2023
Prev Previous commit
Next Next commit
feat: support limit the slow query time range
  • Loading branch information
baurine committed Feb 28, 2023
commit 324d13399a10e548d0fc513a47866d4ab1be8cf7
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,9 @@ export const ctx: ISlowQueryContext = {
enableExport: true,
showDBFilter: true
// instantQuery: false,
// timeRangeSelector: {
// recentSeconds: [3 * 24 * 60 * 60],
// customAbsoluteRangePicker: true
// }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { tz } from '@lib/utils'
import { useTimeRangeValue } from '@lib/components/TimeRangeSelector/hook'
import { telemetry } from '../utils/telemetry'
import { MonitoringContext } from '../context'
// TODO: move to shared folder
import { LimitTimeRange } from '@lib/apps/Overview/components/LimitTimeRange'

export default function Monitoring() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ export interface ISlowQueryConfig extends IContextConfig {
// true means start to search instantly after changing any filter options
// false means only to start searching after clicking the "Query" button
instantQuery?: boolean

// to limit the time range picker range
timeRangeSelector?: {
recentSeconds: number[]
customAbsoluteRangePicker: boolean
}
}

export interface ISlowQueryContext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { useDebounceFn, useMemoizedFn } from 'ahooks'
import { useDeepCompareChange } from '@lib/utils/useChange'
import { isDistro } from '@lib/utils/distro'
import { SlowQueryContext } from '../../context'
import { LimitTimeRange } from '@lib/apps/Overview/components/LimitTimeRange'

const { Option } = Select

Expand Down Expand Up @@ -187,7 +188,17 @@ function List() {
<Card noMarginBottom>
<Toolbar className={styles.list_toolbar} data-e2e="slow_query_toolbar">
<Space>
<TimeRangeSelector value={timeRange} onChange={setTimeRange} />
{ctx?.cfg.timeRangeSelector !== undefined ? (
<LimitTimeRange
value={timeRange}
onChange={setTimeRange}
recent_seconds={ctx.cfg.timeRangeSelector.recentSeconds}
customAbsoluteRangePicker={true}
onZoomOutClick={() => {}}
/>
) : (
<TimeRangeSelector value={timeRange} onChange={setTimeRange} />
)}
{ctx!.cfg.showDBFilter && (
<MultiSelect.Plain
placeholder={t('slow_query.toolbar.schemas.placeholder')}
Expand Down