!216 fix ai_block_io bug and an issue with printing error

From: @zhuofeng6 
Reviewed-by: @znzjugod 
Signed-off-by: @znzjugod
This commit is contained in:
openeuler-ci-bot 2025-03-13 03:20:16 +00:00 committed by Gitee
commit ad9ae9a2ff
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 53 additions and 1 deletions

View File

@ -0,0 +1,45 @@
From bfe11a3c1d9ee11a34ee000509eb328b1e50f193 Mon Sep 17 00:00:00 2001
From: zhuofeng <1107893276@qq.com>
Date: Wed, 12 Mar 2025 02:57:35 +0000
Subject: [PATCH] fix ai_block_io bug and an issue with printing error
Signed-off-by: zhuofeng <1107893276@qq.com>
---
src/python/sentryPlugins/ai_block_io/detector.py | 3 ++-
src/python/syssentry/global_values.py | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/python/sentryPlugins/ai_block_io/detector.py b/src/python/sentryPlugins/ai_block_io/detector.py
index 27fb7f7..2688cb1 100644
--- a/src/python/sentryPlugins/ai_block_io/detector.py
+++ b/src/python/sentryPlugins/ai_block_io/detector.py
@@ -55,11 +55,12 @@ class Detector:
detection_result = self._slidingWindow.is_slow_io_event(metric_value)
# 检测到慢周期由Detector负责打印info级别日志
if detection_result[0][1]:
+ ai_threshold = "None" if detection_result[2] is None else round(detection_result[2], 3)
logging.info(f'[abnormal_period]: disk: {self._metric_name.disk_name}, '
f'stage: {self._metric_name.stage_name}, '
f'iotype: {self._metric_name.io_access_type_name}, '
f'type: {self._metric_name.metric_name}, '
- f'ai_threshold: {round(detection_result[2], 3)}, '
+ f'ai_threshold: {ai_threshold}, '
f'curr_val: {metric_value}')
else:
logging.debug(f'Detection result: {str(detection_result)}')
diff --git a/src/python/syssentry/global_values.py b/src/python/syssentry/global_values.py
index b123b2d..9c7800b 100644
--- a/src/python/syssentry/global_values.py
+++ b/src/python/syssentry/global_values.py
@@ -114,7 +114,7 @@ class InspectTask:
try:
child = subprocess.Popen(cmd_list, stdout=logfile, stderr=subprocess.STDOUT, close_fds=True)
except OSError:
- logging.error("task %s start Popen error, invalid cmd")
+ logging.error("task %s start Popen error, invalid cmd", cmd_list)
self.result_info["result"] = ResultLevel.FAIL.name
self.result_info["error_msg"] = RESULT_LEVEL_ERR_MSG_DICT.get(ResultLevel.FAIL.name)
self.runtime_status = "FAILED"
--
2.43.0

View File

@ -4,7 +4,7 @@
Summary: System Inspection Framework
Name: sysSentry
Version: 1.0.2
Release: 74
Release: 75
License: Mulan PSL v2
Group: System Environment/Daemons
Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz
@ -89,6 +89,7 @@ Patch76: uniform-avg_block_io-log-and-ai_block_io-log.patch
Patch77: set-logrotate.patch
Patch78: ebpf-adpat-to-the-kylin-platform.patch
Patch79: fix-test_ai_block_io-fail.patch
Patch80: fix-ai_block_io-bug-and-an-issue-with-printing-error.patch
BuildRequires: cmake gcc-c++
BuildRequires: python3 python3-setuptools
@ -344,6 +345,12 @@ rm -rf %{buildroot}
%attr(0550,root,root) %{python3_sitelib}/sentryCollector/__pycache__/collect_plugin*
%changelog
* Thu Mar 13 2025 zhuofeng <zhuofeng2@huawei.com> - 1.0.2-75
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:fix ai_block_io bug and an issue with printing error
* Wed Jan 22 2025 shixuantong <shixuantong@huawei.com> - 1.0.2-74
- Type:bugfix
- CVE:NA