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

Feat/sql index advisor #1460

Merged
merged 5 commits into from
Feb 20, 2023
Merged

Conversation

YiniXu9506
Copy link
Contributor

@YiniXu9506 YiniXu9506 commented Jan 4, 2023

What this PR did?

  • Add index insight List Page
  • Add index insight Detail page

image

image

TODO:
Since the test cluster is in production, the preview env has to hard code the orgId/clusterId/projectId. Update orgId/clusterId/projectId when this PR is ready to merge.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jan 4, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • baurine

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@codecov-commenter
Copy link

codecov-commenter commented Jan 6, 2023

Codecov Report

Merging #1460 (3fc90b1) into master (54ad7ea) will increase coverage by 15.74%.
The diff coverage is n/a.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1460       +/-   ##
===========================================
+ Coverage    8.93%   24.67%   +15.74%     
===========================================
  Files         121      167       +46     
  Lines       12682    14972     +2290     
===========================================
+ Hits         1133     3695     +2562     
+ Misses      11428    11006      -422     
- Partials      121      271      +150     
Flag Coverage Δ
backend_integration 8.93% <ø> (ø)
backend_ut 27.25% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54ad7ea...3fc90b1. Read the comment docs.

@YiniXu9506 YiniXu9506 marked this pull request as ready for review January 10, 2023 02:40
@YiniXu9506 YiniXu9506 requested review from shhdgit and baurine and removed request for shhdgit January 10, 2023 02:41
@@ -7,7 +7,7 @@ set -euo pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
PROJECT_DIR=$(cd "$DIR/../.."; pwd)

TARGET="${PROJECT_DIR}/ui/packages/tidb-dashboard-for-op/src/uilts/distro/strings_res.json"
TARGET="${PROJECT_DIR}/ui/packages/tidb-dashboard-for-op/src/utils/distro/strings_res.json"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -45,5 +46,9 @@ export default function () {
return <Monitoring />
}

if (locHashPrefix === 'sql_advisor') {
Copy link
Member

@shhdgit shhdgit Feb 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sync with startsWith after merge master.

setNoTaskRunning(data)
return data
})
.catch((e) => console.log(e))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.catch((e) => console.log(e))

Comment on lines +51 to +81
useEffect(() => {
const checkStatus = async () => {
const _noTaskRunning = (await taskRunningStatusGet.current()) as boolean
if (!_noTaskRunning) {
startCheckTaskStatusLoop.current()
}
}
checkStatus()
}, [])

useEffect(() => {
const checkSQLValidation = async () => {
await ctx?.ds
.sqlValidationGet?.()
.then((res) => {
setShowAlert(!res)
})
.catch((e) => console.log(e))
}

checkSQLValidation()
}, [ctx])
Copy link
Member

@shhdgit shhdgit Feb 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about changing it to the same as taskRunningStatusGet and combining the effect contents?

Suggested change
useEffect(() => {
const checkStatus = async () => {
const _noTaskRunning = (await taskRunningStatusGet.current()) as boolean
if (!_noTaskRunning) {
startCheckTaskStatusLoop.current()
}
}
checkStatus()
}, [])
useEffect(() => {
const checkSQLValidation = async () => {
await ctx?.ds
.sqlValidationGet?.()
.then((res) => {
setShowAlert(!res)
})
.catch((e) => console.log(e))
}
checkSQLValidation()
}, [ctx])
const checkSQLValidation = useRef(() => {
return ctx?.ds
.sqlValidationGet?.()
.then((res) => {
setShowAlert(!res)
})
})
useEffect(() => {
const checkStatus = async () => {
const _noTaskRunning = (await taskRunningStatusGet.current()) as boolean
if (!_noTaskRunning) {
startCheckTaskStatusLoop.current()
}
}
checkStatus()
checkSQLValidation.current()
}, [])

})
}
})
.catch((e) => console.log(e))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.catch((e) => console.log(e))

}
})
} catch (e) {
console.log(e)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need notification.error here?

Comment on lines +178 to +186
const registerUserDBStatusGet = async () => {
await ctx?.ds
.registerUserDBStatusGet?.()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use promise.then, we can forget the async/await.

}, [ctx])

const handleDeactivate = async () => {
await ctx?.ds
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

setIsLoading(false)
setIsUserDBRegistered(data)
})
.catch((e) => console.log(e))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do what we indeed have to do to handle errors or ignore them.

Suggested change
.catch((e) => console.log(e))

})
}
})
.catch((e) => console.log(e))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.catch((e) => console.log(e))

@YiniXu9506 YiniXu9506 merged commit e9f63e2 into pingcap:master Feb 20, 2023
@YiniXu9506 YiniXu9506 deleted the feat/sqlIndexAdvisor branch February 20, 2023 03:01
SabaPing pushed a commit to SabaPing/tidb-dashboard that referenced this pull request Apr 4, 2023
* feat: add insight index advisor app

* chore: sync upstream master

* fix: lint
SabaPing added a commit that referenced this pull request Apr 4, 2023
* chore: adjust time range limit (#1485)

* tweak: change time range by cluster type (#1486)

      * tweak: change time range by cluster type

* fix typo

* Feat/sql index advisor (#1460)

* feat: add insight index advisor app

* chore: sync upstream master

* fix: lint

* chore: add authorization header for api req (#1490)

* chore: add authorization header for api req

* chore: bump tidb-dashboard-for-clinic-cloud to 0.0.51

* chore: refine sql advisor (#1488)

* chore: refine sql advisor

* chore: refine index advisor

* fix: lint

* refine: aysnc await usage

* Revert "upgrade etcd client (#1491)" (#1495)

* Hotifx Index Advisor (#1496)

* chore: slow query and statements apps refines (#1498)

* feat: adjust statement work for serverless clusters (#1500)

* feat: adjust statement to work for serverless cluster

* chore: bump tidb-dashboard-for-clinic-cloud to 0.0.54

* chore: rename CLINIC_UI_DASHBOARD_PATH to TARGET_VARIANT_DASHBOARD_PATH

* fix: fix navigation back miss the selected time range info

* chore: support hide the page load progress bar

* chore: bump tidb-dashboard-for-clinic-cloud to 0.0.55

* chore: slight refine

* chore: bump tidb-dashboard-for-clinic-cloud to 0.0.56

* feat: node metrics (#1501)

* add avg by for metrics query (#1503)

* update metrics chart (#1502)

* update metrics

* update version

* use fixed pnpm version to build image (#1508)

* Fixed issue #1505: Wrong disk mount directory of TiFlash (#1506)

* tweak(perf_insight): update apis & workflow (#1504)

* update version

---------

Co-authored-by: Suhaha <jklopsdfw@gmail.com>
Co-authored-by: Yini Xu <34967660+YiniXu9506@users.noreply.github.com>
Co-authored-by: Sparkle <1284531+baurine@users.noreply.github.com>
Co-authored-by: zzm <zhouzemin@pingcap.com>
Co-authored-by: Justin Huang <legendj228@gmail.com>
Co-authored-by: Zhenchi <zhongzc_arch@outlook.com>
Co-authored-by: Ping An Technology Database Team <109205475+pingandb@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants