oceanbase / obdiag

obdiag (OceanBase Diagnostic Tool) is designed to help OceanBase users quickly gather necessary information and analyze the root cause of the problem.
https://www.oceanbase.com/docs/obdiag-cn
Mulan Permissive Software License, Version 2
138 stars 32 forks source link

[Feature]: 慢SQL问题分析的时候期望组合Plan Monitor Report 报告 + 全链路信息的内容 #375

Open Teingi opened 3 months ago

Teingi commented 3 months ago

Describe your use case

慢SQL问题分析的时候期望组合Plan Monitor Report 报告 + 全链路信息的内容

Describe the solution you'd like

慢SQL问题分析的时候期望组合Plan Monitor Report 报告 + 全链路信息的内容 可以增加参数来让用户同时能拿到这两个信息 原来:obdiag gather scene run --scene=observer.perf_sql --env "{db_connect='-h127.0.0.1 -P2881 -utest@test -p** -Dtest', trace_id='Yxx'}"

新:obdiag gather scene run --scene=observer.perf_sql --env "{db_connect='-h127.0.0.1 -P2881 -utest@test -p** -Dtest', trace_id='Yxx'}" --env need_trace=True

Describe alternatives you've considered

No response

Additional context

No response

Teingi commented 2 months ago

需求解释: 我们在查询慢SQL问题的时候比较常用的两大功能是

  1. obdiag gather plan_monitor --trace_id YB420BA2D99B-0005EBBFC45D5A00-0-0 --env "{db_connect='-hxx -Pxx -uxx -pxx -Dxx'}" 来获取Plan Monitor Report 报告,代码:https://github.com/oceanbase/obdiag/blob/master/handler/gather/gather_plan_monitor.py, 功能文档:https://www.oceanbase.com/docs/common-obdiag-cn-1000000001102520#6-title-obdiag%20gather%20plan_monitor
  2. 全链路诊断,obdiag analyze flt_trace xxxx 代码:https://github.com/oceanbase/obdiag/blob/master/handler/analyzer/analyze_flt_trace.py 功能文档,https://www.oceanbase.com/docs/common-obdiag-cn-1000000001102497#2-title-obdiag%20analyze%20flt_trace

其中方式1的Plan Monitor Report 报告我们还在套餐中进行了封装,就是obdiag gather scene run --scene=observer.perf_sql --env "{db_connect='-h127.0.0.1 -P2881 -utest@test -p** -Dtest', trace_id='Yxx'}",通过这个功能我们直接可以获取Plan Monitor Report,还能获取集群基本信息,日志信息等,但是没有全链路的内容,所以想改造一下,变成obdiag gather scene run --scene=observer.perf_sql --env "{db_connect='-h127.0.0.1 -P2881 -utest@test -p** -Dtest', trace_id='Yxx'}" --env need_trace=True,如果--env need_trace=True则调用一下全链路诊断功能。