Skip to content

Commit f33cd0c

Browse files
authored
support mysql slow sql (#13)
1 parent 7d0c7f8 commit f33cd0c

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

manager/src/main/resources/define/app/app-mysql.yml

+40
Original file line numberDiff line numberDiff line change
@@ -617,3 +617,43 @@ metrics:
617617
# sql
618618
sql: select if(command = 'Sleep', 'Sleep', state) as state, count(*) as num from information_schema.PROCESSLIST group by state;
619619
url: ^_^url^_^
620+
621+
- name: slow_sql
622+
priority: 2
623+
fields:
624+
- field: id
625+
type: 1
626+
instance: true
627+
- field: sql_text
628+
type: 0
629+
- field: start_time
630+
type: 1
631+
- field: db
632+
type: 1
633+
- field: query_time
634+
type: 1
635+
aliasFields:
636+
- sql_text
637+
- start_time
638+
- db
639+
- query_time
640+
# (非必须)指标计算表达式,与上面的别名一起作用,计算出最终需要的指标值
641+
# eg: cores=core1+core2, usage=usage, waitTime=allTime-runningTime
642+
calculates:
643+
- id= start_time + sql_text
644+
protocol: jdbc
645+
jdbc:
646+
# 主机host: ipv4 ipv6 域名
647+
host: ^_^host^_^
648+
# 端口
649+
port: ^_^port^_^
650+
platform: mysql
651+
username: ^_^username^_^
652+
password: ^_^password^_^
653+
database: ^_^database^_^
654+
timeout: ^_^timeout^_^
655+
# SQL查询方式: oneRow, multiRow, columns
656+
queryType: multiRow
657+
# sql
658+
sql: select sql_text, start_time, db, query_time from mysql.slow_log;
659+
url: ^_^url^_^

0 commit comments

Comments
 (0)