From 27e482df2237bdb76a4468cbaf796c8475887e99 Mon Sep 17 00:00:00 2001 From: Teingi Date: Mon, 18 Mar 2024 10:34:04 +0800 Subject: [PATCH 1/3] release 1.6.2 --- docs/gather_perf.md | 9 +++------ handler/gather/gather_perf.py | 12 ------------ handler/gather/scenes/cpu_high.py | 14 ++++++++++++++ handler/gather/scenes/sql_problem.py | 2 +- rpm/build.sh | 2 +- rpm/oceanbase-diagnostic-tool.spec | 2 +- utils/parser_utils.py | 4 ++-- 7 files changed, 22 insertions(+), 23 deletions(-) diff --git a/docs/gather_perf.md b/docs/gather_perf.md index e0240913..bbd217d1 100644 --- a/docs/gather_perf.md +++ b/docs/gather_perf.md @@ -2,7 +2,6 @@ - 支持一键获取observer进程的"扁鹊图" ,ob运行态的调用关系,用"sample"代指 - 支持一键获取observer进程的"perf 火焰图", 用"flame"代指 -- 支持一键获取observer进程的"pstack 火焰图", 用"pstack"代指 ``` $ obdiag gather perf [-h] @@ -24,11 +23,10 @@ Gather Perf Summary: +----------------+-----------+----------+--------+-------------------------------------------------------------------+ ``` -scope 可选项: ["sample", "flame", "pstack", "all"] +scope 可选项: ["sample", "flame", "all"] - sample:表示采集扁鹊图 - flame: 表示采集ob的Perf火焰图 -- pstack: 表示采集pstack火焰图 -- all: 表示扁鹊图、ob的Perf火焰图、pstack火焰图都采集,默认值 +- all: 表示扁鹊图、ob的perf火焰图,默认值 ## 查看结果 收集到的数据是通过perf工具进行采集的,可以通过Flame Graph中的工具对数据进行图形转化 @@ -38,11 +36,10 @@ scope 可选项: ["sample", "flame", "pstack", "all"] 1. 解压收集到的数据 解压采集到的文件,例如解压:perf_192.168.2.11_20230117140836.zip,解压之后有如下文件 ```shell script -flame.viz flame.data pstack.viz sample.data sample.viz +flame.viz flame.data sample.data sample.viz ``` 对应关系如下: - flame.viz(perf 火焰图) -- pstack.viz(pstack 火焰图) - sample.viz(扁鹊图) diff --git a/handler/gather/gather_perf.py b/handler/gather/gather_perf.py index 4117cb83..4db8604c 100644 --- a/handler/gather/gather_perf.py +++ b/handler/gather/gather_perf.py @@ -131,12 +131,9 @@ def __handle_from_node(self, node, local_stored_path): self.__gather_perf_sample(ssh_helper, remote_dir_full_path, pid_observer) elif self.scope == "flame": self.__gather_perf_flame(ssh_helper, remote_dir_full_path, pid_observer) - elif self.scope == "pstack": - self.__gather_pstack(ssh_helper, remote_dir_full_path, pid_observer) else: self.__gather_perf_sample(ssh_helper, remote_dir_full_path, pid_observer) self.__gather_perf_flame(ssh_helper, remote_dir_full_path, pid_observer) - self.__gather_pstack(ssh_helper, remote_dir_full_path, pid_observer) self.__gather_top(ssh_helper, remote_dir_full_path, pid_observer) zip_dir(self.is_ssh, ssh_helper, "/tmp", remote_dir_name) @@ -181,15 +178,6 @@ def __gather_perf_flame(self, ssh_helper, gather_path, pid_observer): except: logger.error("generate perf data on server [{0}] failed".format(ssh_helper.get_name())) - def __gather_pstack(self, ssh_helper, gather_path, pid_observer): - try: - pstack_cmd = "cd {gather_path} && pstack {pid} > pstack.viz".format( - gather_path=gather_path, pid=pid_observer) - logger.info("gather pstack, run cmd = [{0}]".format(pstack_cmd)) - SshClient().run(ssh_helper, pstack_cmd) if self.is_ssh else LocalClient().run(pstack_cmd) - except: - logger.error("gather pstack on server failed [{0}]".format(ssh_helper.get_name())) - def __gather_top(self, ssh_helper, gather_path, pid_observer): try: cmd = "cd {gather_path} && top -Hp {pid} -b -n 1 > top.txt".format( diff --git a/handler/gather/scenes/cpu_high.py b/handler/gather/scenes/cpu_high.py index ae7fce0e..dba402a8 100644 --- a/handler/gather/scenes/cpu_high.py +++ b/handler/gather/scenes/cpu_high.py @@ -21,6 +21,7 @@ from handler.gather.gather_obstack2 import GatherObstack2Handler from handler.gather.gather_perf import GatherPerfHandler from utils.parser_utils import ParserAction +from handler.gather.gather_log import GatherLogHandler class CPUHighScene(object): def __init__(self, nodes, cluster, report_path, task_variable_dict=None, args=None, env={}): @@ -34,11 +35,13 @@ def __init__(self, nodes, cluster, report_path, task_variable_dict=None, args=No self.args = args self.env = env self.is_ssh = True + self.ob_nodes = nodes def execute(self): self.__gather_obstack() self.__gather_perf() self.__gather_current_clocksource() + self.__gather_log() def __gather_obstack(self): logger.info("gather obstack start") @@ -67,6 +70,17 @@ def __gather_current_clocksource(self): except Exception as e: logger.error("SshHandler init fail. Please check the node conf. Exception : {0} .".format(e)) + def __gather_log(self): + try: + logger.info("gather observer log start") + handler = GatherLogHandler(nodes=self.ob_nodes, gather_pack_dir=self.report_path, is_scene=True) + self.args = ParserAction.add_attribute_to_namespace(self.args, 'grep', None) + handler.handle(self.args) + logger.info("gather observer log end") + except Exception as e: + logger.error("gather observer log failed, error: {0}".format(e)) + raise Exception("gather observer log failed, error: {0}".format(e)) + def report(self, file_path, command, data): try: with open(file_path, 'a', encoding='utf-8') as f: diff --git a/handler/gather/scenes/sql_problem.py b/handler/gather/scenes/sql_problem.py index a80bf33b..743739e3 100644 --- a/handler/gather/scenes/sql_problem.py +++ b/handler/gather/scenes/sql_problem.py @@ -51,7 +51,7 @@ def __gather_log(self): try: logger.info("gather observer log start") handler = GatherLogHandler(nodes=self.ob_nodes, gather_pack_dir=self.report_path, is_scene=True) - self.args = ParserAction.add_attribute_to_namespace(self.args, 'grep', "") + self.args = ParserAction.add_attribute_to_namespace(self.args, 'grep', None) handler.handle(self.args) logger.info("gather observer log end") except Exception as e: diff --git a/rpm/build.sh b/rpm/build.sh index 1741bec3..f94cb22a 100755 --- a/rpm/build.sh +++ b/rpm/build.sh @@ -2,7 +2,7 @@ python_bin='python' W_DIR=`pwd` -VERSION=${VERSION:-'1.6.1'} +VERSION=${VERSION:-'1.7.0'} function python_version() diff --git a/rpm/oceanbase-diagnostic-tool.spec b/rpm/oceanbase-diagnostic-tool.spec index caf2fc54..2ec57b28 100644 --- a/rpm/oceanbase-diagnostic-tool.spec +++ b/rpm/oceanbase-diagnostic-tool.spec @@ -1,5 +1,5 @@ Name: oceanbase-diagnostic-tool -Version:1.6.1 +Version:1.7.0 Release: %(echo $RELEASE)%{?dist} Summary: oceanbase diagnostic tool program Group: Development/Tools diff --git a/utils/parser_utils.py b/utils/parser_utils.py index 36069950..8783b54e 100644 --- a/utils/parser_utils.py +++ b/utils/parser_utils.py @@ -185,10 +185,10 @@ def parse_argv(self, argv=None): "compress and pack, and transmit to the specified path of the obdiag machine.") gather_perf_arguments.set_defaults(gather_sysstat=self.client.handle_gather_perf_command) gather_perf_arguments.add_argument("--scope", metavar="scope", nargs=1, - choices=["sample", "flame", "pstack", "all"], + choices=["sample", "flame", "all"], default="all", help="perf type constrains, " - "choices=[sample, flame, pstack, all], " + "choices=[sample, flame, all], " "default=all") # gather 子命令 plan_monitor From 7f742641d17385facf40d12cec74194f2e7daf18 Mon Sep 17 00:00:00 2001 From: Teingi Date: Mon, 18 Mar 2024 10:36:14 +0800 Subject: [PATCH 2/3] release 1.6.2 --- rpm/build.sh | 2 +- rpm/oceanbase-diagnostic-tool.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rpm/build.sh b/rpm/build.sh index f94cb22a..e7699421 100755 --- a/rpm/build.sh +++ b/rpm/build.sh @@ -2,7 +2,7 @@ python_bin='python' W_DIR=`pwd` -VERSION=${VERSION:-'1.7.0'} +VERSION=${VERSION:-'1.5.2'} function python_version() diff --git a/rpm/oceanbase-diagnostic-tool.spec b/rpm/oceanbase-diagnostic-tool.spec index 2ec57b28..2ba1bb5d 100644 --- a/rpm/oceanbase-diagnostic-tool.spec +++ b/rpm/oceanbase-diagnostic-tool.spec @@ -1,5 +1,5 @@ Name: oceanbase-diagnostic-tool -Version:1.7.0 +Version:1.6.2 Release: %(echo $RELEASE)%{?dist} Summary: oceanbase diagnostic tool program Group: Development/Tools From d06e1e35743d5b5ce06d7c711ea1ff5845e2f825 Mon Sep 17 00:00:00 2001 From: Teingi Date: Mon, 18 Mar 2024 10:37:36 +0800 Subject: [PATCH 3/3] release 1.6.2 --- rpm/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpm/build.sh b/rpm/build.sh index e7699421..8b12da03 100755 --- a/rpm/build.sh +++ b/rpm/build.sh @@ -2,7 +2,7 @@ python_bin='python' W_DIR=`pwd` -VERSION=${VERSION:-'1.5.2'} +VERSION=${VERSION:-'1.6.2'} function python_version()