From 0154718ede19e719fd4850bace46477e261b8559 Mon Sep 17 00:00:00 2001 From: "jingshun.tq" <35712518+Teingi@users.noreply.github.com> Date: Mon, 15 Jul 2024 14:50:39 +0800 Subject: [PATCH] Fix regression testing bugs (#324) * table dump print pretty result * Fix regression testing bugs * Fix regression testing bugs * Optimize logs * Optimize logs * Optimize logs --- diag_cmd.py | 2 +- handler/analyzer/analyze_flt_trace.py | 3 ++- handler/analyzer/analyze_log.py | 2 +- handler/analyzer/analyze_parameter.py | 8 ++++---- handler/analyzer/analyze_sql.py | 2 +- handler/analyzer/analyze_sql_review.py | 2 +- handler/analyzer/analyze_variable.py | 6 +++--- handler/gather/gather_ash_report.py | 2 +- handler/gather/gather_awr.py | 2 +- handler/gather/gather_log.py | 2 +- handler/gather/gather_obadmin.py | 2 +- handler/gather/gather_obproxy_log.py | 2 +- handler/gather/gather_obstack2.py | 3 +-- handler/gather/gather_parameters.py | 16 ++++++++-------- handler/gather/gather_perf.py | 11 ++++++----- handler/gather/gather_plan_monitor.py | 2 +- handler/gather/gather_scenes.py | 2 +- handler/gather/gather_sysstat.py | 2 +- handler/gather/gather_tabledump.py | 2 +- handler/gather/gather_variables.py | 10 +++++----- 20 files changed, 42 insertions(+), 41 deletions(-) diff --git a/diag_cmd.py b/diag_cmd.py index 49b31fb1..24f8a6ec 100644 --- a/diag_cmd.py +++ b/diag_cmd.py @@ -744,7 +744,7 @@ def _do_command(self, obdiag): class ObdiagAnalyzeSQLReviewCommand(ObdiagOriginCommand): def __init__(self): - super(ObdiagAnalyzeSQLReviewCommand, self).__init__('sql_review', 'Analyze oceanbase sql from sql_audit ') + super(ObdiagAnalyzeSQLReviewCommand, self).__init__('sql_review', 'Analyze oceanbase sql from file') self.parser.add_option('--host', type='string', help="tenant connection host") self.parser.add_option('--port', type='string', help="tenant connection port") self.parser.add_option('--password', type='string', help="tenant connection user password", default='') diff --git a/handler/analyzer/analyze_flt_trace.py b/handler/analyzer/analyze_flt_trace.py index fb14ccae..8624baaf 100644 --- a/handler/analyzer/analyze_flt_trace.py +++ b/handler/analyzer/analyze_flt_trace.py @@ -192,7 +192,7 @@ def check_filename(filename): log_full_path = "{gather_path}/{log_name}".format(log_name=self.flt_trace_id, gather_path=gather_path) download_file(ssh_client, log_full_path, local_store_path, self.stdio) - def __get_offline_log_file(self, ssh_client, log_full_path, local_store_dir): + def __get_offline_log_file(self, ssh_client, log_path, local_store_dir): """ :param ssh_client, log_name :return: @@ -202,6 +202,7 @@ def __get_offline_log_file(self, ssh_client, log_full_path, local_store_dir): if self.flt_trace_id is not None and (len(log_name_list) > 0): grep_cmd = "grep -e '{grep_args}' {log_file} > {local_store_path} ".format(grep_args=self.flt_trace_id, log_file=' '.join(log_name_list), local_store_path=local_store_path) LocalClient(self.stdio).run(grep_cmd) + log_full_path = "{gather_path}/{log_name}".format(gather_path=log_path, log_name=self.flt_trace_id) download_file(ssh_client, log_full_path, local_store_path, self.stdio) def __get_log_name_list_offline(self): diff --git a/handler/analyzer/analyze_log.py b/handler/analyzer/analyze_log.py index 0d4a9646..434211e6 100644 --- a/handler/analyzer/analyze_log.py +++ b/handler/analyzer/analyze_log.py @@ -110,7 +110,7 @@ def init_option(self): self.stdio.print('analyze log from_time: {0}, to_time: {1}'.format(self.from_time_str, self.to_time_str)) if store_dir_option is not None: if not os.path.exists(os.path.abspath(store_dir_option)): - self.stdio.warn('Error: args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) + self.stdio.warn('args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) os.makedirs(os.path.abspath(store_dir_option)) self.gather_pack_dir = os.path.abspath(store_dir_option) if grep_option is not None: diff --git a/handler/analyzer/analyze_parameter.py b/handler/analyzer/analyze_parameter.py index 97ca13cc..47b51480 100644 --- a/handler/analyzer/analyze_parameter.py +++ b/handler/analyzer/analyze_parameter.py @@ -59,8 +59,8 @@ def get_version(self): try: observer_version = get_observer_version_by_sql(self.ob_cluster, self.stdio) except Exception as e: - self.stdio.warn("AnalyzeHandler Failed to get observer version:{0}".format(e)) - self.stdio.verbose("AnalyzeHandler.init get observer version: {0}".format(observer_version)) + self.stdio.warn("failed to get observer version:{0}".format(e)) + self.stdio.verbose("get observer version: {0}".format(observer_version)) return observer_version def handle(self): @@ -82,7 +82,7 @@ def init_option_non_default(self): offline_file_option = Util.get_option(options, 'file') if store_dir_option and store_dir_option != "./": if not os.path.exists(os.path.abspath(store_dir_option)): - self.stdio.warn('warn: args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) + self.stdio.warn('args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) os.makedirs(os.path.abspath(store_dir_option)) self.export_report_path = os.path.abspath(store_dir_option) else: @@ -105,7 +105,7 @@ def init_option_diff(self): offline_file_option = Util.get_option(options, 'file') if store_dir_option and store_dir_option != "./": if not os.path.exists(os.path.abspath(store_dir_option)): - self.stdio.warn('warn: args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) + self.stdio.warn('args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) os.makedirs(os.path.abspath(store_dir_option)) self.export_report_path = os.path.abspath(store_dir_option) else: diff --git a/handler/analyzer/analyze_sql.py b/handler/analyzer/analyze_sql.py index d54168e3..e6ab6374 100644 --- a/handler/analyzer/analyze_sql.py +++ b/handler/analyzer/analyze_sql.py @@ -161,7 +161,7 @@ def init_option(self): store_dir_option = Util.get_option(options, 'store_dir') if store_dir_option is not None: if not os.path.exists(os.path.abspath(store_dir_option)): - self.stdio.warn('Error: args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) + self.stdio.warn('args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) os.makedirs(os.path.abspath(store_dir_option)) self.local_stored_parrent_path = os.path.abspath(store_dir_option) output_option = Util.get_option(options, 'output') diff --git a/handler/analyzer/analyze_sql_review.py b/handler/analyzer/analyze_sql_review.py index 1b69f3eb..c4253705 100644 --- a/handler/analyzer/analyze_sql_review.py +++ b/handler/analyzer/analyze_sql_review.py @@ -91,7 +91,7 @@ def init_option(self): store_dir_option = Util.get_option(options, 'store_dir') if store_dir_option is not None: if not os.path.exists(os.path.abspath(store_dir_option)): - self.stdio.warn('Error: args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) + self.stdio.warn('args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) os.makedirs(os.path.abspath(store_dir_option)) self.local_stored_parrent_path = os.path.abspath(store_dir_option) output_option = Util.get_option(options, 'output') diff --git a/handler/analyzer/analyze_variable.py b/handler/analyzer/analyze_variable.py index 43fc8d32..478c3c3d 100644 --- a/handler/analyzer/analyze_variable.py +++ b/handler/analyzer/analyze_variable.py @@ -48,8 +48,8 @@ def __init__(self, context): database="oceanbase", ) except Exception as e: - self.stdio.error("Failed to connect to database: {0}".format(e)) - raise OBDIAGFormatException("Failed to connect to database: {0}".format(e)) + self.stdio.error("failed to connect to database: {0}".format(e)) + raise OBDIAGFormatException("failed to connect to database: {0}".format(e)) def handle(self): if not self.init_option(): @@ -75,7 +75,7 @@ def init_option(self): if store_dir_option and store_dir_option != "./": if not os.path.exists(os.path.abspath(store_dir_option)): - self.stdio.warn('warn: args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) + self.stdio.warn('args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) os.makedirs(os.path.abspath(store_dir_option)) self.export_report_path = os.path.abspath(store_dir_option) else: diff --git a/handler/gather/gather_ash_report.py b/handler/gather/gather_ash_report.py index f6aa955e..fc1e4eb1 100644 --- a/handler/gather/gather_ash_report.py +++ b/handler/gather/gather_ash_report.py @@ -153,7 +153,7 @@ def init_option(self): self.stdio.print('gather from_time: {0}, to_time: {1}'.format(self.from_time_str, self.to_time_str)) if store_dir_option: if not os.path.exists(os.path.abspath(store_dir_option)): - self.stdio.warn('warn: args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) + self.stdio.warn('args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) os.makedirs(os.path.abspath(store_dir_option)) self.gather_pack_dir = os.path.abspath(store_dir_option) if sql_id_option: diff --git a/handler/gather/gather_awr.py b/handler/gather/gather_awr.py index 9e58d106..bec5b9e6 100644 --- a/handler/gather/gather_awr.py +++ b/handler/gather/gather_awr.py @@ -270,7 +270,7 @@ def init_option(self): self.stdio.print('gather log from_time: {0}, to_time: {1}'.format(self.from_time_str, self.to_time_str)) if store_dir_option and store_dir_option != "./": if not os.path.exists(os.path.abspath(store_dir_option)): - self.stdio.warn('warn: args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) + self.stdio.warn('args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) os.makedirs(os.path.abspath(store_dir_option)) self.gather_pack_dir = os.path.abspath(store_dir_option) return True diff --git a/handler/gather/gather_log.py b/handler/gather/gather_log.py index 8bbbf412..f368cab5 100644 --- a/handler/gather/gather_log.py +++ b/handler/gather/gather_log.py @@ -118,7 +118,7 @@ def init_option(self): self.stdio.print('gather log from_time: {0}, to_time: {1}'.format(self.from_time_str, self.to_time_str)) if store_dir_option is not None and store_dir_option != './': if not os.path.exists(os.path.abspath(store_dir_option)): - self.stdio.warn('warn: args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) + self.stdio.warn('args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) os.makedirs(os.path.abspath(store_dir_option)) self.gather_pack_dir = os.path.abspath(store_dir_option) if scope_option: diff --git a/handler/gather/gather_obadmin.py b/handler/gather/gather_obadmin.py index 39169fc5..a7c3da04 100644 --- a/handler/gather/gather_obadmin.py +++ b/handler/gather/gather_obadmin.py @@ -106,7 +106,7 @@ def init_option(self): self.stdio.print('gather from_time: {0}, to_time: {1}'.format(self.from_time_str, self.to_time_str)) if store_dir_option and store_dir_option != './': if not os.path.exists(os.path.abspath(store_dir_option)): - self.stdio.warn('Error: args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) + self.stdio.warn('args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) os.makedirs(os.path.abspath(store_dir_option)) self.local_stored_path = os.path.abspath(store_dir_option) if encrypt_option == "true": diff --git a/handler/gather/gather_obproxy_log.py b/handler/gather/gather_obproxy_log.py index 265e6446..efd54b37 100644 --- a/handler/gather/gather_obproxy_log.py +++ b/handler/gather/gather_obproxy_log.py @@ -121,7 +121,7 @@ def init_option(self): self.stdio.print('gather from_time: {0}, to_time: {1}'.format(self.from_time_str, self.to_time_str)) if store_dir_option and store_dir_option != './': if not os.path.exists(os.path.abspath(store_dir_option)): - self.stdio.warn('warn: args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) + self.stdio.warn('args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) os.makedirs(os.path.abspath(store_dir_option)) self.gather_pack_dir = os.path.abspath(store_dir_option) if scope_option: diff --git a/handler/gather/gather_obstack2.py b/handler/gather/gather_obstack2.py index 2178a51e..2ca09f70 100644 --- a/handler/gather/gather_obstack2.py +++ b/handler/gather/gather_obstack2.py @@ -69,7 +69,7 @@ def init_option(self): store_dir_option = Util.get_option(options, 'store_dir') if store_dir_option and store_dir_option != './': if not os.path.exists(os.path.abspath(store_dir_option)): - self.stdio.warn('warn: args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) + self.stdio.warn('args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) os.makedirs(os.path.abspath(store_dir_option)) self.local_stored_path = os.path.abspath(store_dir_option) return True @@ -224,7 +224,6 @@ def __gather_obstack2_info(self, ssh_client, user, observer_pid, remote_gather_d ssh_client.exec_cmd(chown_cmd) self.stdio.verbose("gather obstack info on server {0}, run cmd = [su {1}, {2}]".format(ssh_client.get_name(), user, cmd)) ssh_client.ssh_invoke_shell_switch_user(user, cmd, 10) - ssh_client.exec_cmd("rm -rf /tmp/{0}".format(remote_gather_dir)) @staticmethod def __get_overall_summary(node_summary_tuple): diff --git a/handler/gather/gather_parameters.py b/handler/gather/gather_parameters.py index bec7463e..ea553faf 100644 --- a/handler/gather/gather_parameters.py +++ b/handler/gather/gather_parameters.py @@ -47,8 +47,8 @@ def __init__(self, context, gather_pack_dir='./'): database="oceanbase", ) except Exception as e: - self.stdio.error("Failed to connect to database: {0}".format(e)) - raise OBDIAGFormatException("Failed to connect to database: {0}".format(e)) + self.stdio.error("failed to connect to database: {0}".format(e)) + raise OBDIAGFormatException("failed to connect to database: {0}".format(e)) def handle(self): if not self.init_option(): @@ -66,7 +66,7 @@ def init_option(self): store_dir_option = Util.get_option(options, 'store_dir') if store_dir_option and store_dir_option != "./": if not os.path.exists(os.path.abspath(store_dir_option)): - self.stdio.warn('warn: args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) + self.stdio.warn('args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) os.makedirs(os.path.abspath(store_dir_option)) self.gather_pack_dir = os.path.abspath(store_dir_option) return True @@ -76,8 +76,8 @@ def get_version(self): try: observer_version = get_observer_version_by_sql(self.ob_cluster, self.stdio) except Exception as e: - self.stdio.warn("GatherHandler Failed to get observer version:{0}".format(e)) - self.stdio.verbose("GatherHandler.init get observer version: {0}".format(observer_version)) + self.stdio.warn("failed to get observer version:{0}".format(e)) + self.stdio.verbose("get observer version: {0}".format(observer_version)) return observer_version def get_cluster_name(self): @@ -87,8 +87,8 @@ def get_cluster_name(self): cluster_info = self.obconn.execute_sql(sql) cluster_name = cluster_info[0][0] except Exception as e: - self.stdio.warn("RCAHandler Failed to get oceanbase cluster name:{0}".format(e)) - self.stdio.verbose("RCAHandler.init get oceanbase cluster name {0}".format(cluster_name)) + self.stdio.warn("failed to get oceanbase cluster name:{0}".format(e)) + self.stdio.verbose("get oceanbase cluster name {0}".format(cluster_name)) return cluster_name def get_parameters_info(self): @@ -121,7 +121,7 @@ def get_parameters_info(self): writer.writerow(row) self.stdio.print("Gather parameters finished. For more details, please run cmd '" + Fore.YELLOW + "cat {0}".format(self.parameter_file_name) + Style.RESET_ALL + "'") else: - self.stdio.warn("Failed to retrieve the database version. Please check if the database connection is normal.") + self.stdio.warn("failed to retrieve the database version. Please check if the database connection is normal.") def execute(self): try: diff --git a/handler/gather/gather_perf.py b/handler/gather/gather_perf.py index e9244425..db792d3d 100644 --- a/handler/gather/gather_perf.py +++ b/handler/gather/gather_perf.py @@ -22,7 +22,7 @@ import tabulate from common.command import get_observer_pid, mkdir, zip_dir, get_file_size, download_file, delete_file_force -from common.command import LocalClient, SshClient +from common.command import SshClient from common.constant import const from handler.base_shell_handler import BaseShellHandler from common.tool import Util @@ -70,7 +70,7 @@ def init_option(self): store_dir_option = Util.get_option(options, 'store_dir') if store_dir_option and store_dir_option != './': if not os.path.exists(os.path.abspath(store_dir_option)): - self.stdio.warn('warn: args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) + self.stdio.warn('args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) os.makedirs(os.path.abspath(store_dir_option)) self.local_stored_path = os.path.abspath(store_dir_option) self.scope_option = Util.get_option(options, 'scope') @@ -118,9 +118,6 @@ def __handle_from_node(self, node, local_stored_path): resp = {"skip": False, "error": "", "gather_pack_path": ""} remote_ip = node.get("ip") if self.is_ssh else NetUtils.get_inner_ip(self.stdio) remote_user = node.get("ssh_username") - remote_password = node.get("ssh_password") - remote_port = node.get("ssh_port") - remote_private_key = node.get("ssh_key_file") self.stdio.verbose("Sending Collect Shell Command to node {0} ...".format(remote_ip)) DirectoryUtil.mkdir(path=local_stored_path, stdio=self.stdio) now_time = datetime.datetime.now().strftime('%Y%m%d%H%M%S') @@ -167,17 +164,20 @@ def __handle_from_node(self, node, local_stored_path): def __gather_perf_sample(self, ssh_client, gather_path, pid_observer): try: + self.stdio.start_loading('gather perf sample') cmd = "cd {gather_path} && perf record -o sample.data -e cycles -c 100000000 -p {pid} -g -- sleep 20".format(gather_path=gather_path, pid=pid_observer) self.stdio.verbose("gather perf sample, run cmd = [{0}]".format(cmd)) ssh_client.exec_cmd(cmd) generate_data = "cd {gather_path} && perf script -i sample.data -F ip,sym -f > sample.viz".format(gather_path=gather_path) self.stdio.verbose("generate perf sample data, run cmd = [{0}]".format(generate_data)) ssh_client.exec_cmd(generate_data) + self.stdio.stop_loading('gather perf sample') except: self.stdio.error("generate perf sample data on server [{0}] failed".format(ssh_client.get_name())) def __gather_perf_flame(self, ssh_client, gather_path, pid_observer): try: + self.stdio.start_loading('gather perf flame') perf_cmd = "cd {gather_path} && perf record -o flame.data -F 99 -p {pid} -g -- sleep 20".format(gather_path=gather_path, pid=pid_observer) self.stdio.verbose("gather perf, run cmd = [{0}]".format(perf_cmd)) ssh_client.exec_cmd(perf_cmd) @@ -185,6 +185,7 @@ def __gather_perf_flame(self, ssh_client, gather_path, pid_observer): generate_data = "cd {gather_path} && perf script -i flame.data > flame.viz".format(gather_path=gather_path) self.stdio.verbose("generate perf data, run cmd = [{0}]".format(generate_data)) ssh_client.exec_cmd(generate_data) + self.stdio.stop_loading('gather perf flame') except: self.stdio.error("generate perf data on server [{0}] failed".format(ssh_client.get_name())) diff --git a/handler/gather/gather_plan_monitor.py b/handler/gather/gather_plan_monitor.py index 454c49a5..38683d8e 100644 --- a/handler/gather/gather_plan_monitor.py +++ b/handler/gather/gather_plan_monitor.py @@ -259,7 +259,7 @@ def get_table_info(self, file_path): data = f.read() return data except Exception as e: - self.stdio.error(e) + self.stdio.warn(e) return None def report_schema(self, sql, tenant_name): diff --git a/handler/gather/gather_scenes.py b/handler/gather/gather_scenes.py index b782c672..d54e2f57 100644 --- a/handler/gather/gather_scenes.py +++ b/handler/gather/gather_scenes.py @@ -209,7 +209,7 @@ def init_option(self): self.stdio.print('gather from_time: {0}, to_time: {1}'.format(self.from_time_str, self.to_time_str)) if store_dir_option: if not os.path.exists(os.path.abspath(store_dir_option)): - self.stdio.warn('warn: args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) + self.stdio.warn('args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) os.makedirs(os.path.abspath(store_dir_option)) self.gather_pack_dir = os.path.abspath(store_dir_option) if scene_option: diff --git a/handler/gather/gather_sysstat.py b/handler/gather/gather_sysstat.py index f9299c7d..a77dff57 100644 --- a/handler/gather/gather_sysstat.py +++ b/handler/gather/gather_sysstat.py @@ -71,7 +71,7 @@ def init_option(self): store_dir_option = Util.get_option(options, 'store_dir') if store_dir_option and store_dir_option != './': if not os.path.exists(os.path.abspath(store_dir_option)): - self.stdio.warn('warn: args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) + self.stdio.warn('args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) os.makedirs(os.path.abspath(store_dir_option)) self.local_stored_path = os.path.abspath(store_dir_option) self.scope_option = Util.get_option(options, 'scope') diff --git a/handler/gather/gather_tabledump.py b/handler/gather/gather_tabledump.py index 61196405..834c80c4 100644 --- a/handler/gather/gather_tabledump.py +++ b/handler/gather/gather_tabledump.py @@ -112,7 +112,7 @@ def execute(self): self.__get_table_info_v3() except Exception as e: self.stdio.error("report sql result to file: {0} failed, error: ".format(self.file_name)) - self.stdio.error("StepSQLHandler execute Exception: {0}".format(e).strip()) + self.stdio.error("GatherTableDumpHandler execute Exception: {0}".format(e).strip()) def __get_table_schema(self): sql = "show create table " + self.database + "." + self.table diff --git a/handler/gather/gather_variables.py b/handler/gather/gather_variables.py index 55c790ba..34729a3b 100644 --- a/handler/gather/gather_variables.py +++ b/handler/gather/gather_variables.py @@ -46,8 +46,8 @@ def __init__(self, context, gather_pack_dir='./'): database="oceanbase", ) except Exception as e: - self.stdio.error("Failed to connect to database: {0}".format(e)) - raise OBDIAGFormatException("Failed to connect to database: {0}".format(e)) + self.stdio.error("failed to connect to database: {0}".format(e)) + raise OBDIAGFormatException("failed to connect to database: {0}".format(e)) def handle(self): if not self.init_option(): @@ -64,7 +64,7 @@ def init_option(self): store_dir_option = Util.get_option(options, 'store_dir') if store_dir_option and store_dir_option != "./": if not os.path.exists(os.path.abspath(store_dir_option)): - self.stdio.warn('warn: args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) + self.stdio.warn('args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(store_dir_option))) os.makedirs(os.path.abspath(store_dir_option)) self.gather_pack_dir = os.path.abspath(store_dir_option) return True @@ -76,8 +76,8 @@ def get_cluster_name(self): cluster_info = self.obconn.execute_sql(sql) cluster_name = cluster_info[0][0] except Exception as e: - self.stdio.warn("RCAHandler Failed to get oceanbase cluster name:{0}".format(e)) - self.stdio.verbose("RCAHandler.init get oceanbase cluster name {0}".format(cluster_name)) + self.stdio.warn("failed to get oceanbase cluster name:{0}".format(e)) + self.stdio.verbose("get oceanbase cluster name {0}".format(cluster_name)) return cluster_name def get_variables_info(self):