From d599500d764dab315faff3cd072978ddb16c0393 Mon Sep 17 00:00:00 2001 From: xuyan wang <35394786+wayyoungboy@users.noreply.github.com> Date: Thu, 2 Jan 2025 16:49:44 +0800 Subject: [PATCH] Compatibility for non UTF-8 encoding in obproxy logs in disconnected scenarios (#662) --- plugins/rca/disconnection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/rca/disconnection.py b/plugins/rca/disconnection.py index 89791365..f8cccfce 100644 --- a/plugins/rca/disconnection.py +++ b/plugins/rca/disconnection.py @@ -83,7 +83,7 @@ def __execute_obproxy_one_node(self, node): if parses_number >= self.max_parses_number: break self.stdio.verbose("read the log file: {0}".format(name)) - with open(name, 'r') as f: + with open(name, 'r', errors='ignore') as f: log_list = f.read().strip().split('\n') for line in log_list: try: @@ -153,7 +153,7 @@ def __init__(self, context, log, record): for log_name in logs_name: if observer_trace_id != "Y0-0000000000000000-0-0": break - with open(log_name, 'r') as f: + with open(log_name, 'r', errors='ignore') as f: log_list = f.read().strip().split('\n') for line in log_list: if "session_id:" in line and "trace_id:" in line: