From b54e3a3af7621b14c0568411ceeb681b961de5ac Mon Sep 17 00:00:00 2001 From: wayyoungboy <35394786+wayyoungboy@users.noreply.github.com> Date: Wed, 17 Jul 2024 10:46:37 +0800 Subject: [PATCH 1/3] fix gather_obproxy_log.py (#341) --- handler/gather/gather_obproxy_log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handler/gather/gather_obproxy_log.py b/handler/gather/gather_obproxy_log.py index 9f7b60fd..ee32c8b7 100644 --- a/handler/gather/gather_obproxy_log.py +++ b/handler/gather/gather_obproxy_log.py @@ -274,7 +274,7 @@ def __pharse_log(self, ssh_client, home_path, log_name, gather_path): grep_cmd = "grep -e '{0}' ".format(grep_arg) + "{log_dir}/{log_name}".format(log_name=log_name, log_dir=log_path) continue grep_cmd += "| grep -e '{0}'".format(grep_arg) - grep_cmd += " >> {log_dir}/{log_name}".format(log_name=log_name, log_dir=log_path) + grep_cmd += " >> {gather_path}/{log_name}".format(log_name=log_name, gather_path=gather_path) self.stdio.verbose("grep files, run cmd = [{0}]".format(grep_cmd)) ssh_client.exec_cmd(grep_cmd) else: From 2b2360905ba97ff0a929be3d47302cca211253b0 Mon Sep 17 00:00:00 2001 From: wayyoungboy <35394786+wayyoungboy@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:11:23 +0800 Subject: [PATCH 2/3] fix gather all (#344) * fix gather_obproxy_log.py * fix sshclient upload * build test package * delete test package --- common/ssh_client/local_client.py | 2 +- common/ssh_client/remote_client.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/ssh_client/local_client.py b/common/ssh_client/local_client.py index 52ee2ca9..b7d849d6 100644 --- a/common/ssh_client/local_client.py +++ b/common/ssh_client/local_client.py @@ -48,7 +48,7 @@ def upload(self, remote_path, local_path): try: shutil.copy(local_path, remote_path) except Exception as e: - self.stdio.error("upload file to localhost, remote _path =[{0}], local _path=[{1}], error=[{2}]".format(remote_path, local_path, str(e))) + self.stdio.error("upload file to localhost, remote_path =[{0}], local_path=[{1}], error=[{2}]".format(remote_path, local_path, str(e))) raise Exception("[local] upload file to localhost, remote _path =[{0}], local _path=[{1}], error=[{2}]".format(remote_path, local_path, str(e))) def ssh_invoke_shell_switch_user(self, new_user, cmd, time_out): diff --git a/common/ssh_client/remote_client.py b/common/ssh_client/remote_client.py index 6bcfdaf6..b128be0e 100644 --- a/common/ssh_client/remote_client.py +++ b/common/ssh_client/remote_client.py @@ -105,7 +105,7 @@ def progress_bar(self, transferred, to_be_transferred, suffix=''): def upload(self, remote_path, local_path): transport = self._ssh_fd.get_transport() self._sftp_client = paramiko.SFTPClient.from_transport(transport) - self._sftp_client.put(remote_path, local_path) + self._sftp_client.put(local_path, remote_path) self._sftp_client.close() def ssh_invoke_shell_switch_user(self, new_user, cmd, time_out): From 71283b69699f61bb8af2032045d4ef12dee9bcf4 Mon Sep 17 00:00:00 2001 From: jingyd66 <82036232+jingyd66@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:26:01 +0800 Subject: [PATCH 3/3] update0717 (#343) --- handler/rca/scene/index_ddl_error_scene.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/handler/rca/scene/index_ddl_error_scene.py b/handler/rca/scene/index_ddl_error_scene.py index 0d28ff5a..e9ffc39e 100644 --- a/handler/rca/scene/index_ddl_error_scene.py +++ b/handler/rca/scene/index_ddl_error_scene.py @@ -136,6 +136,9 @@ def execute(self): self.verbose("gather rootservice.log by {0}".format(self.trace_id)) work_path_rs = self.store_dir + "/{0}_on_rs/".format(self.trace_id) self.gather_log.set_parameters("scope", "rootservice") + if self.input_parameters.get("since") is not None: + since = self.input_parameters.get("since") + self.gather_log.set_parameters("since", since) self.gather_log.grep("{0}".format(self.trace_id)) logs_name = self.gather_log.execute(save_path=work_path_rs) if logs_name is None or len(logs_name) <= 0: @@ -161,6 +164,9 @@ def execute(self): self.verbose("gather observer.log by {0}".format(self.trace_id)) work_path_ddl_wait_trans_end_ctx_try_wait = self.store_dir + "/{0}_on_obs/".format(self.trace_id) self.gather_log.set_parameters("scope", "observer") + if self.input_parameters.get("since") is not None: + since = self.input_parameters.get("since") + self.gather_log.set_parameters("since", since) self.gather_log.grep("{0}".format(self.trace_id)) logs_name = self.gather_log.execute(save_path=work_path_ddl_wait_trans_end_ctx_try_wait) if logs_name is None or len(logs_name) <= 0: @@ -176,6 +182,9 @@ def execute(self): # index_sstable_build_task_finish work_path_index_sstable_build_task_finish = self.store_dir + "/{0}_on_obs/".format(self.trace_id) self.gather_log.set_parameters("scope", "observer") + if self.input_parameters.get("since") is not None: + since = self.input_parameters.get("since") + self.gather_log.set_parameters("since", since) self.gather_log.grep("{0}".format(self.trace_id)) logs_name = self.gather_log.execute(save_path=work_path_index_sstable_build_task_finish) if logs_name is None or len(logs_name) <= 0: @@ -191,6 +200,9 @@ def execute(self): self.verbose("gather rootservice.log by {0}".format(self.trace_id)) work_path_rs = self.store_dir + "/{0}_on_rs/".format(self.trace_id) self.gather_log.set_parameters("scope", "rootservice") + if self.input_parameters.get("since") is not None: + since = self.input_parameters.get("since") + self.gather_log.set_parameters("since", since) self.gather_log.grep("{0}".format(self.trace_id)) logs_name = self.gather_log.execute(save_path=work_path_rs) if logs_name is None or len(logs_name) <= 0: