fix bug: when ai_threshold update, absolute threshold not be used.
Signed-off-by: 贺有志 <1037617413@qq.com>
This commit is contained in:
parent
d04e1820e6
commit
b6ef2506d2
56
fix-absolute-threshold-not-be-used.patch
Normal file
56
fix-absolute-threshold-not-be-used.patch
Normal file
@ -0,0 +1,56 @@
|
||||
From 11483f4efe29ac971379f845078701f44b430682 Mon Sep 17 00:00:00 2001
|
||||
From: Youzhi He <heyouzhi@huawei.com>
|
||||
Date: Fri, 15 Nov 2024 17:34:35 +0800
|
||||
Subject: [PATCH] fix when ai threshold update but absolute threshold not be
|
||||
used
|
||||
|
||||
---
|
||||
.../ai_block_io/sliding_window.py | 20 +++++++++----------
|
||||
1 file changed, 10 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/python/sentryPlugins/ai_block_io/sliding_window.py b/src/python/sentryPlugins/ai_block_io/sliding_window.py
|
||||
index ff3fa3b..a13033f 100644
|
||||
--- a/src/python/sentryPlugins/ai_block_io/sliding_window.py
|
||||
+++ b/src/python/sentryPlugins/ai_block_io/sliding_window.py
|
||||
@@ -30,20 +30,20 @@ class SlidingWindow:
|
||||
self._io_data_queue = []
|
||||
self._io_data_queue_abnormal_tag = []
|
||||
|
||||
+ def is_abnormal(self, data):
|
||||
+ if self._avg_lim is not None and data < self._avg_lim:
|
||||
+ return False
|
||||
+ if self._ai_threshold is not None and data > self._ai_threshold:
|
||||
+ return True
|
||||
+ if self._abs_threshold is not None and data > self._abs_threshold:
|
||||
+ return True
|
||||
+
|
||||
def push(self, data: float):
|
||||
if len(self._io_data_queue) == self._queue_length:
|
||||
self._io_data_queue.pop(0)
|
||||
self._io_data_queue_abnormal_tag.pop(0)
|
||||
self._io_data_queue.append(data)
|
||||
- tag = False
|
||||
- if self._avg_lim is not None and data < self._avg_lim:
|
||||
- tag = False
|
||||
- self._io_data_queue_abnormal_tag.append(tag)
|
||||
- return tag
|
||||
- if self._ai_threshold is not None and data > self._ai_threshold:
|
||||
- tag = True
|
||||
- if self._abs_threshold is not None and data > self._abs_threshold:
|
||||
- tag = True
|
||||
+ tag = self.is_abnormal(data)
|
||||
self._io_data_queue_abnormal_tag.append(tag)
|
||||
return tag
|
||||
|
||||
@@ -53,7 +53,7 @@ class SlidingWindow:
|
||||
self._ai_threshold = threshold
|
||||
self._io_data_queue_abnormal_tag.clear()
|
||||
for data in self._io_data_queue:
|
||||
- self._io_data_queue_abnormal_tag.append(data >= self._ai_threshold)
|
||||
+ self._io_data_queue_abnormal_tag.append(self.is_abnormal(data))
|
||||
|
||||
def is_slow_io_event(self, data):
|
||||
return False, None, None, None
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
Summary: System Inspection Framework
|
||||
Name: sysSentry
|
||||
Version: 1.0.2
|
||||
Release: 66
|
||||
Release: 67
|
||||
License: Mulan PSL v2
|
||||
Group: System Environment/Daemons
|
||||
Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz
|
||||
@ -82,6 +82,7 @@ Patch69: modify-logrotate-rule.patch
|
||||
Patch70: fix-excessive-CPU-usage.patch
|
||||
Patch71: change-avg_block_io-config.patch
|
||||
Patch72: update-nvme-config.patch
|
||||
Patch73: fix-absolute-threshold-not-be-used.patch
|
||||
|
||||
BuildRequires: cmake gcc-c++
|
||||
BuildRequires: python3 python3-setuptools
|
||||
@ -353,6 +354,12 @@ rm -rf %{buildroot}
|
||||
%attr(0550,root,root) %{python3_sitelib}/sentryCollector/__pycache__/collect_plugin*
|
||||
|
||||
%changelog
|
||||
* Fri Nov 15 2024 heyouzhi <heyouzhi@huawei.com> - 1.0.2-67
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
- SUG:NA
|
||||
- DESC:fix absolute threshold not be used
|
||||
|
||||
* Tue Nov 5 2024 zhangnan <zhangnan134@huawei.com> - 1.0.2-66
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user