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

add more time field for slow query detail page #810

Merged
merged 32 commits into from
Nov 26, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
fe1c1a9
add more time field for slow query detail page
crazycs520 Nov 24, 2020
1729986
add exec retry time
crazycs520 Nov 24, 2020
043467d
refine
crazycs520 Nov 24, 2020
4ce951f
add wait ts
crazycs520 Nov 25, 2020
6d022e0
refine display
crazycs520 Nov 25, 2020
9c424c7
add more comment
crazycs520 Nov 25, 2020
c43ecdf
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
a3aad95
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
c005bb2
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
fea6b6b
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
10de098
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
cf9daa9
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
5607611
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
46b54a2
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
d90c6cf
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
71e6c8f
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
5e3d883
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
8f8d00b
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
dd40265
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
26bcd44
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
6626815
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
453c127
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
4190910
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
f38822e
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
a4e88e0
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
b08e954
Update ui/lib/apps/SlowQuery/translations/en.yaml
crazycs520 Nov 26, 2020
388aecc
refine time model
crazycs520 Nov 26, 2020
f66d54d
address comment
crazycs520 Nov 26, 2020
949f991
refine comment
crazycs520 Nov 26, 2020
cb2decc
Apply suggestions from code review
breezewish Nov 26, 2020
fd85096
Merge branch 'master' into add-more-time-field
breezewish Nov 26, 2020
cd56b4f
Apply suggestions from code review
breezewish Nov 26, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 27 additions & 19 deletions pkg/apiserver/slowquery/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,17 @@ type SlowQuery struct {
ConnectionID string `gorm:"column:Conn_ID" json:"connection_id"`
Success int `gorm:"column:Succ" json:"success"`

Timestamp float64 `gorm:"column:timestamp" proj:"(UNIX_TIMESTAMP(Time) + 0E0)" json:"timestamp"` // finish time
QueryTime float64 `gorm:"column:Query_time" json:"query_time"` // latency
ParseTime float64 `gorm:"column:Parse_time" json:"parse_time"`
CompileTime float64 `gorm:"column:Compile_time" json:"compile_time"`
ProcessTime float64 `gorm:"column:Process_time" json:"process_time"`
Timestamp float64 `gorm:"column:timestamp" proj:"(UNIX_TIMESTAMP(Time) + 0E0)" json:"timestamp"` // finish time
QueryTime float64 `gorm:"column:Query_time" json:"query_time"` // latency
ParseTime float64 `gorm:"column:Parse_time" json:"parse_time"`
CompileTime float64 `gorm:"column:Compile_time" json:"compile_time"`
RewriteTime float64 `gorm:"column:Rewrite_time" json:"rewrite_time"`
PreprocSubqueriesTime float64 `gorm:"column:Preproc_subqueries_time" json:"preproc_subqueries_time"`
OptimizeTime float64 `gorm:"column:Optimize_time" json:"optimize_time"`
CopTime float64 `gorm:"column:Cop_time" json:"cop_time"`
LockKeysTime float64 `gorm:"column:LockKeys_time" json:"lock_keys_time"`
WriteRespTime float64 `gorm:"column:Write_sql_response_total" json:"write_sql_response_total"`
ExecRetryTime float64 `gorm:"column:Exec_retry_time" json:"exec_retry_time"`

MemoryMax int `gorm:"column:Mem_max" json:"memory_max"`
DiskMax int `gorm:"column:Disk_max" json:"disk_max"`
Expand All @@ -63,20 +69,22 @@ type SlowQuery struct {
Host string `gorm:"column:Host" json:"host"`

// Time
WaitTime float64 `gorm:"column:Wait_time" json:"wait_time"`
BackoffTime float64 `gorm:"column:Backoff_time" json:"backoff_time"`
GetCommitTSTime float64 `gorm:"column:Get_commit_ts_time" json:"get_commit_ts_time"`
LocalLatchWaitTime float64 `gorm:"column:Local_latch_wait_time" json:"local_latch_wait_time"`
ResolveLockTime float64 `gorm:"column:Resolve_lock_time" json:"resolve_lock_time"`
PrewriteTime float64 `gorm:"column:Prewrite_time" json:"prewrite_time"`
CommitTime float64 `gorm:"column:Commit_time" json:"commit_time"`
CommitBackoffTime float64 `gorm:"column:Commit_backoff_time" json:"commit_backoff_time"`
CopProcAvg float64 `gorm:"column:Cop_proc_avg" json:"cop_proc_avg"`
CopProcP90 float64 `gorm:"column:Cop_proc_p90" json:"cop_proc_p90"`
CopProcMax float64 `gorm:"column:Cop_proc_max" json:"cop_proc_max"`
CopWaitAvg float64 `gorm:"column:Cop_wait_avg" json:"cop_wait_avg"`
CopWaitP90 float64 `gorm:"column:Cop_wait_p90" json:"cop_wait_p90"`
CopWaitMax float64 `gorm:"column:Cop_wait_max" json:"cop_wait_max"`
ProcessTime float64 `gorm:"column:Process_time" json:"process_time"`
WaitTime float64 `gorm:"column:Wait_time" json:"wait_time"`
BackoffTime float64 `gorm:"column:Backoff_time" json:"backoff_time"`
GetCommitTSTime float64 `gorm:"column:Get_commit_ts_time" json:"get_commit_ts_time"`
LocalLatchWaitTime float64 `gorm:"column:Local_latch_wait_time" json:"local_latch_wait_time"`
ResolveLockTime float64 `gorm:"column:Resolve_lock_time" json:"resolve_lock_time"`
PrewriteTime float64 `gorm:"column:Prewrite_time" json:"prewrite_time"`
WaitPreWriteBinlogTime float64 `gorm:"column:Wait_prewrite_binlog_time" json:"wait_prewrite_binlog_time"`
CommitTime float64 `gorm:"column:Commit_time" json:"commit_time"`
CommitBackoffTime float64 `gorm:"column:Commit_backoff_time" json:"commit_backoff_time"`
CopProcAvg float64 `gorm:"column:Cop_proc_avg" json:"cop_proc_avg"`
CopProcP90 float64 `gorm:"column:Cop_proc_p90" json:"cop_proc_p90"`
CopProcMax float64 `gorm:"column:Cop_proc_max" json:"cop_proc_max"`
CopWaitAvg float64 `gorm:"column:Cop_wait_avg" json:"cop_wait_avg"`
CopWaitP90 float64 `gorm:"column:Cop_wait_p90" json:"cop_wait_p90"`
CopWaitMax float64 `gorm:"column:Cop_wait_max" json:"cop_wait_max"`

// Transaction
WriteKeys int `gorm:"column:Write_keys" json:"write_keys"`
Expand Down
32 changes: 32 additions & 0 deletions ui/lib/apps/SlowQuery/pages/Detail/DetailTabTime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@ export default function TabBasic({ data }: ITabTimeProps) {
key: 'compile_time',
value: data.compile_time! * 10e8,
},
{
key: 'rewrite_time',
value: data.rewrite_time! * 10e8,
},
{
key: 'preproc_subqueries_time',
value: data.preproc_subqueries_time! * 10e8,
},
{
key: 'optimize_time',
value: data.optimize_time! * 10e8,
},
{
key: 'cop_time',
value: data.cop_time! * 10e8,
},
{
key: 'lock_keys_time',
value: data.lock_keys_time! * 10e8,
},
{
key: 'wait_time',
value: data.wait_time! * 10e8,
Expand Down Expand Up @@ -48,6 +68,10 @@ export default function TabBasic({ data }: ITabTimeProps) {
key: 'prewrite_time',
value: data.prewrite_time! * 10e8,
},
{
key: 'wait_prewrite_binlog_time',
value: data.wait_prewrite_binlog_time! * 10e8,
},
{
key: 'commit_time',
value: data.commit_time! * 10e8,
Expand All @@ -56,6 +80,14 @@ export default function TabBasic({ data }: ITabTimeProps) {
key: 'commit_backoff_time',
value: data.commit_backoff_time! * 10e8,
},
{
key: 'write_sql_response_total',
value: data.write_sql_response_total! * 10e8,
},
{
key: 'exec_retry_time',
value: data.exec_retry_time! * 10e8,
},
{
key: 'query_time2',
keyDisplay: (
Expand Down
15 changes: 13 additions & 2 deletions ui/lib/apps/SlowQuery/translations/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,14 @@ slow_query:

parse_time: Parse Time
parse_time_tooltip: Time consumed when parsing the query
compile_time: Compile Time
compile_time_tooltip: Time consumed when optimizing the query
compile_time: Generate plan Time
compile_time_tooltip: Time consumed when generating plan of the query
Copy link
Member

Choose a reason for hiding this comment

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

This tooltip does not provide new information, so that it can be either removed, or make it more detailed.

crazycs520 marked this conversation as resolved.
Show resolved Hide resolved
rewrite_time: Rewrite plan Time
preproc_subqueries_time: Preprocess subquery Time
optimize_time: Optimize plan Time
cop_time: Cop request Time
lock_keys_time: Lock keys Time
lock_keys_time_tooltip: Time consumed when locking keys in pessimistic transaction
wait_time: Coprocessor Wait Time
process_time: Coprocessor Process Time
backoff_time: Backoff Retry Time
Expand All @@ -46,10 +52,15 @@ slow_query:
local_latch_wait_time: Local Latch Wait Time
resolve_lock_time: Resolve Lock Time
prewrite_time: Prewrite Time
wait_prewrite_binlog_time: Wait binlog prewrite Time
commit_time: Commit Time
commit_backoff_time: Commit Backoff Time
query_time2: Query Time
query_time2_tooltip: The execution time of a query (due to the parallel execution, it may be significantly smaller than the above time)
write_sql_response_total: Send response Time
write_sql_response_total_tooltip: Time consumed when sending response to the client
crazycs520 marked this conversation as resolved.
Show resolved Hide resolved
exec_retry_time: Retry execution Time
exec_retry_time_tooltip: Time consumed of retry execution

request_count: Request Count
process_keys: Process Keys
Expand Down
14 changes: 12 additions & 2 deletions ui/lib/apps/SlowQuery/translations/zh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ slow_query:

parse_time: 解析耗时
parse_time_tooltip: 解析该 SQL 查询的耗时
compile_time: 优化耗时
compile_time_tooltip: 优化该 SQL 查询的耗时
compile_time: 生成执行计划耗时
compile_time_tooltip: 生成该 SQL 的执行计划的耗时
rewrite_time: 重写执行计划耗时
preproc_subqueries_time: 子查询预处理耗时
optimize_time: 优化执行计划耗时
cop_time: cop 请求耗时
lock_keys_time: 上锁耗时
wait_time: Coprocessor 累计等待耗时
process_time: Coprocessor 累计执行耗时
process_time_tooltip: Coprocessor 累计执行耗时
Expand All @@ -49,10 +54,15 @@ slow_query:
resolve_lock_time: Resolve Lock 耗时
resolve_lock_time_tooltip: 事务在 TiKV 与其他事务产生了锁冲突并处理锁冲突的耗时
prewrite_time: Prewrite 阶段耗时
wait_prewrite_binlog_time: 等 binlog 预写入耗时
commit_time: Commit 阶段耗时
commit_backoff_time: Commit 重试等待耗时
query_time2: SQL 执行时间
query_time2_tooltip: 由于存在并行执行,因此 SQL 执行时间可能远小于上述各项时间
write_sql_response_total: 发送结果耗时
write_sql_response_total_tooltip: 发送 SQL 结果给客户端的耗时
exec_retry_time: 执行重试耗时
exec_retry_time_tooltip: 执行失败时时执行重试耗时

request_count: Coprocessor 请求数
process_keys: 可见版本数
Expand Down