TiDB Dashboard Slow Query Not Displaying

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb dashboard 慢查询无法显示

| username: xmlianfeng

[TiDB Usage Environment] Production Environment
[TiDB Version]
v6.1.5
[Encountered Problem: Symptoms and Impact]
The slow query page on the dashboard shows common.bad_request 400

URL:
http://1.1.1.1:2379/dashboard/api/slow_query/list?begin_time=1678950184&desc=true&digest=&end_time=1678950485&fields=query%2Ctimestamp%2Cquery_time%2Cmemory_max&limit=100&orderBy=query_time&text=

Currently tried restarting the PD node, but it did not resolve the issue. How should I handle this?
[Attachments: Screenshots/Logs/Monitoring]

PD node logs
[2023/03/16 14:54:47.489 +08:00] [WARN] [error.go:89] [“Error when handling request”] [uri=“/dashboard/api/slow_query/list?begin_time=1678947887&desc=true&digest=&end_time=1678949688&fields=query%2Ctimestamp%2Cquery_time%2Cmemory_max&limit=100&orderBy=query_time&text=”] [remoteAddr=10.7.7.3:64373] [errorFullText=“common.bad_request\n at github.com/pingcap/tidb-dashboard/pkg/apiserver/slowquery.(*Service).getList()\n\t/go/pkg/mod/github.com/pingcap/tidb-dashboard@v0.0.0-20220518164040-4d621864a9a0/pkg/apiserver/slowquery/service.go:76\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/context.go:165\n at github.com/pingcap/tidb-dashboard/pkg/apiserver/utils.MWConnectTiDB.func1()\n\t/go/pkg/mod/github.com/pingcap/tidb-dashboard@v0.0.0-20220518164040-4d621864a9a0/pkg/apiserver/utils/tidb_conn.go:66\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/context.go:165\n at github.com/breeswish/gin-jwt/v2.(*GinJWTMiddleware).middlewareImpl()\n\t/go/pkg/mod/github.com/breeswish/gin-jwt/v2@v2.6.4-jwt-patch/auth_jwt.go:403\n at github.com/pingcap/tidb-dashboard/pkg/apiserver/user.(*AuthService).MWAuthRequired.func1()\n\t/go/pkg/mod/github.com/breeswish/gin-jwt/v2@v2.6.4-jwt-patch/auth_jwt.go:365\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/context.go:165\n at github.com/pingcap/tidb-dashboard/util/rest.ErrorHandlerFn.func1()\n\t/go/pkg/mod/github.com/pingcap/tidb-dashboard@v0.0.0-20220518164040-4d621864a9a0/util/rest/error.go:70\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/context.go:165\n at github.com/gin-contrib/gzip.Gzip.func2()\n\t/go/pkg/mod/github.com/gin-contrib/gzip@v0.0.1/gzip.go:47\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/context.go:165\n at github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1()\n\t/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/recovery.go:99\n at github.com/gin-gonic/gin.(*Context).Next()\n\t/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/context.go:165\n at github.com/gin-gonic/gin.(*Engine).handleHTTPRequest()\n\t/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/gin.go:489\n at github.com/gin-gonic/gin.(*Engine).ServeHTTP()\n\t/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/gin.go:445\n at github.com/pingcap/tidb-dashboard/pkg/apiserver.(*Service).handler()\n\t/go/pkg/mod/github.com/pingcap/tidb-dashboard@v0.0.0-20220518164040-4d621864a9a0/pkg/apiserver/apiserver.go:240\n at net/http.HandlerFunc.ServeHTTP()\n\t/usr/local/go/src/net/http/server.go:2109\n at github.com/pingcap/tidb-dashboard/pkg/utils.(*ServiceStatus).NewStatusAwareHandler.func1()\n\t/go/pkg/mod/github.com/pingcap/tidb-dashboard@v0.0.0-20220518164040-4d621864a9a0/pkg/utils/service_status.go:67\n at net/http.HandlerFunc.ServeHTTP()\n\t/usr/local/go/src/net/http/server.go:2109\n at net/http.(*ServeMux).ServeHTTP()\n\t/usr/local/go/src/net/http/server.go:2487\n at go.etcd.io/etcd/embed.(*accessController).ServeHTTP()\n\t/go/pkg/mod/go.etcd.io/etcd@v0.5.0-alpha.5.0.20191023171146-3cf2f69b5738/embed/serve.go:359\n at net/http.serverHandler.ServeHTTP()\n\t/usr/local/go/src/net/http/server.go:2947\n at net/http.(*conn).serve()\n\t/usr/local/go/src/net/http/server.go:1991\n at runtime.goexit()\n\t/usr/local/go/src/runtime/asm_amd64.s:1594”]

| username: xfworld | Original post link

Show the cluster status.

| username: tidb菜鸟一只 | Original post link

Other pages can be opened, but only the slow query page cannot be opened?

| username: xmlianfeng | Original post link

The cluster status is all normal.

| username: xmlianfeng | Original post link

Yeah, so it’s really frustrating. It feels like such a pain.

| username: Kongdom | Original post link

Try restarting the PD|UI node.

| username: xfworld | Original post link

Replace a PD to support UI capabilities, which is mentioned in the official documentation.

| username: 裤衩儿飞上天 | Original post link

Check if there are particularly many slow days.

| username: 考试没答案 | Original post link

The connection you posted is 1.1.1.1:2379. Did you do something in between???

| username: 考试没答案 | Original post link

Is there any issue with directly accessing 10.10.10.74:2379/dashboard?? Or is it the same issue?

| username: xmlianfeng | Original post link

Sorry, I simply missed it when censoring the screenshot.

| username: xmlianfeng | Original post link

I switched to a new node and the query is normal.
tiup ctl:v<CLUSTER_VERSION> pd -u http://127.0.0.1:2379 config set dashboard-address http://9.9.9.9:2379

| username: 考试没答案 | Original post link

If you have set up forwarding with Nginx, you can directly access and check it.

| username: xfworld | Original post link

Congratulations~ You can consider scaling down the problematic node and then scaling it up again.