forked from oceanbase/obdiag
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
111 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ on: | |
push: | ||
branches: | ||
- master | ||
- 2.6.0_display | ||
|
||
env: | ||
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,119 @@ | ||
info_en: "[topsql info]" | ||
info_cn: "[查看topsql]" | ||
command: obdiag display scene run --scene=observer.topsql --env db_connect='-h127.0.0.1 -P2881 -utest@test -p****** -Dtest' --env mtime=10 | ||
# command: obdiag display scene run --scene=observer.topsql --env db_connect='-h127.0.0.1 -P2881 -utest@test -p****** -Dtest' --env mtime=10 | ||
command: obdiag display scene run --scene=observer.tenant_info --env tenant_name=test --env mtime=10 | ||
|
||
task: | ||
# - version: "[4.0.0.0, *]" | ||
# steps: | ||
# - type: sql | ||
# sql: "select tenant_name, SQL_ID, count(*) as QPS, avg(t1.ELAPSED_TIME) as ELAPSED_TIME_AVG, substr(query_sql,1,50) | ||
# from oceanbase.gv$ob_sql_audit t1 | ||
# where | ||
# IS_EXECUTOR_RPC = 0 | ||
# and request_time > (time_to_usec(now()) - {mtime} * 60 * 1000000) | ||
# and request_time < time_to_usec(now()) | ||
# and length(query_sql) > 0 | ||
# and IS_INNER_SQL = 0 | ||
# and length(sql_id) > 0 | ||
# group by t1.sql_id order by QPS desc limit 10;" | ||
# global: true | ||
- version: "[4.0.0.0, *]" | ||
steps: | ||
- type: sql | ||
sql: "select tenant_name, SQL_ID, count(*) as QPS, avg(t1.ELAPSED_TIME) as ELAPSED_TIME_AVG, substr(query_sql,1,50) | ||
tittle: Top SQL time consumption in the last {mtime} minutes | ||
sql: "select /*+read_consistency(weak),query_timeout(100000000)*/ tenant_name,SQL_ID,QUERY_SQL,count(1),avg(ELAPSED_TIME),avg(EXECUTE_TIME),avg(QUEUE_TIME),avg(AFFECTED_ROWS),avg(GET_PLAN_TIME) | ||
from gv$ob_sql_audit | ||
where time_to_usec(now(6))-request_time <{mtime}*60*1000000 | ||
and tenant_name='{tenant_name}' | ||
group by SQL_ID order by avg(ELAPSED_TIME)*count(1) desc limit 20;" | ||
global: true | ||
- type: sql | ||
tittle: Top-N SQL queries ranked by request count in the last {mtime} minutes | ||
sql: "select /*+read_consistency(weak),query_timeout(100000000)*/ tenant_name,SQL_ID, QUERY_SQL,count(*) as QPS, avg(t1.elapsed_time) RT | ||
from oceanbase.gv$ob_sql_audit t1 | ||
where | ||
IS_EXECUTOR_RPC = 0 | ||
and request_time > (time_to_usec(now()) - {mtime} * 60 * 1000000) | ||
where tenant_name='{tenant_name}' and IS_EXECUTOR_RPC = 0 | ||
and request_time > (time_to_usec(now()) - {mtime}*60*1000000) | ||
and request_time < time_to_usec(now()) | ||
group by t1.sql_id order by QPS desc limit 20;" | ||
global: true | ||
- type: sql | ||
tittle: The SQL that consumes the most CPU among all SQLs in the last {mtime} minutes | ||
sql: "select /*+read_consistency(weak),query_timeout(100000000)*/ tenant_name,sql_id, substr(query_sql, 1, 20) as query_sql, | ||
sum(elapsed_time - queue_time) sum_t, count(*) cnt, | ||
avg(get_plan_time), avg(execute_time) | ||
from oceanbase.gv$ob_sql_audit | ||
where tenant_name ='{tenant_name}' | ||
and request_time > (time_to_usec(now()) - {mtime}*60*1000000) | ||
and request_time < time_to_usec(now()) | ||
group by sql_id order by sum_t desc limit 20;" | ||
global: true | ||
- type: sql | ||
tittle: Check whether there have been a large number of unreasonable remote execution requests for SQL executions in the past {mtime} minutes | ||
sql: "select/ *+read_consistency(weak),query_timeout(100000000)*/ count(*), plan_type | ||
from oceanbase.gv$ob_sql_audit | ||
where tenant_name ='{tenant_name}' | ||
and IS_EXECUTOR_RPC = 0 | ||
and request_time > (time_to_usec(now()) - {mtime}*60*1000000) | ||
and request_time < time_to_usec(now()) | ||
group by plan_type limit 20;" | ||
global: true | ||
- type: sql | ||
tittle: SQL for querying a full table scan | ||
sql: "select /*+read_consistency(weak),query_timeout(100000000)*/ query_sql | ||
from oceanbase.gv$ob_sql_audit | ||
where table_scan = 1 and tenant_name = '{tenant_name}' | ||
and request_time > (time_to_usec(now()) - {mtime}*60*1000000) | ||
and request_time < time_to_usec(now()) | ||
group by sql_id limit 20;" | ||
global: true | ||
- version: "[3.0.0.0, *]" | ||
steps: | ||
- type: sql | ||
tittle: Top SQL time consumption in the last {mtime} minutes | ||
sql: "select /*+read_consistency(weak),query_timeout(100000000)*/ tenant_name,SQL_ID,QUERY_SQL,count(1),avg(ELAPSED_TIME),avg(EXECUTE_TIME),avg(QUEUE_TIME),avg(AFFECTED_ROWS),avg(GET_PLAN_TIME) | ||
from gv$sql_audit | ||
where time_to_usec(now(6))-request_time <{mtime}*60*1000000 | ||
and tenant_name='{tenant_name}' | ||
group by SQL_ID order by avg(ELAPSED_TIME)*count(1) desc limit 20 ;" | ||
global: true | ||
- type: sql | ||
tittle: Top-N SQL queries ranked by request count in the last {mtime} minutes | ||
sql: "select /*+read_consistency(weak),query_timeout(100000000)*/ tenant_name, SQL_ID,QUERY_SQL, count(*) as QPS, avg(t1.elapsed_time) RT | ||
from oceanbase.gv$sql_audit t1 | ||
where tenant_name='{tenant_name}' | ||
and IS_EXECUTOR_RPC = 0 | ||
and request_time > (time_to_usec(now()) - {mtime}*60*1000000) | ||
and request_time < time_to_usec(now()) | ||
group by t1.sql_id order by QPS desc limit 20;" | ||
global: true | ||
- type: sql | ||
tittle: The SQL that consumes the most CPU among all SQLs in the last {mtime} minutes | ||
sql: "select /*+read_consistency(weak),query_timeout(100000000)*/ tenant_name,sql_id, substr(query_sql, 1, 20) as query_sql, | ||
sum(elapsed_time - queue_time) sum_t, count(*) cnt, | ||
avg(get_plan_time), avg(execute_time) | ||
from oceanbase.gv$sql_audit | ||
where tenant_name='{tenant_name}' | ||
and request_time > (time_to_usec(now()) - {mtime}*60*1000000) | ||
and request_time < time_to_usec(now()) | ||
group by sql_id order by sum_t desc limit 20;" | ||
global: true | ||
- type: sql | ||
tittle: Check whether there have been a large number of unreasonable remote execution requests for SQL executions in the past {mtime} minutes | ||
sql: "select /*+read_consistency(weak),query_timeout(100000000)*/ count(*), plan_type | ||
from oceanbase.gv$sql_audit | ||
where tenant_name='{tenant_name}' | ||
and IS_EXECUTOR_RPC = 0 | ||
and request_time > (time_to_usec(now()) - {mtime}*60*1000000) | ||
and request_time < time_to_usec(now()) | ||
group by plan_type limit 20;" | ||
global: true | ||
- type: sql | ||
tittle: SQL for querying a full table scan | ||
sql: "select /*+read_consistency(weak),query_timeout(100000000)*/ query_sql | ||
from oceanbase.gv$sql_audit | ||
where table_scan = 1 and tenant_name = '{tenant_name}' | ||
and request_time > (time_to_usec(now()) - {mtime}*60*10000) | ||
and request_time < time_to_usec(now()) | ||
and length(query_sql) > 0 | ||
and IS_INNER_SQL = 0 | ||
and length(sql_id) > 0 | ||
group by t1.sql_id order by QPS desc limit 10;" | ||
group by sql_id limit 20;" | ||
global: true |