sysSentry/uniform-avg_block_io-log-and-ai_block_io-log.patch
jinsaihang 48704857e2 uniform plugins log
Signed-off-by: jinsaihang <jinsaihang@h-partners.com>
2024-12-19 10:51:23 +08:00

64 lines
3.4 KiB
Diff

From c8f21d1621e96e2c8a239f8028cc9331aa0f8997 Mon Sep 17 00:00:00 2001
From: jinsaihang <jinsaihang@h-partners.com>
Date: Tue, 17 Dec 2024 11:36:11 +0800
Subject: [PATCH] uniform avg_block_io log and ai_block_io log
Signed-off-by: jinsaihang <jinsaihang@h-partners.com>
---
src/python/sentryPlugins/ai_block_io/ai_block_io.py | 5 +++++
src/python/sentryPlugins/ai_block_io/detector.py | 8 +++-----
src/python/sentryPlugins/avg_block_io/stage_window.py | 2 +-
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/python/sentryPlugins/ai_block_io/ai_block_io.py b/src/python/sentryPlugins/ai_block_io/ai_block_io.py
index 14f740d..8075f5f 100644
--- a/src/python/sentryPlugins/ai_block_io/ai_block_io.py
+++ b/src/python/sentryPlugins/ai_block_io/ai_block_io.py
@@ -208,6 +208,11 @@ class SlowIODetection:
tmp_alarm_content = alarm_content.copy()
del tmp_alarm_content["details"]
logging.warning("[SLOW IO] " + str(tmp_alarm_content))
+ logging.warning(f'[SLOW IO] disk: {str(tmp_alarm_content.get("driver_name"))}, '
+ f'stage: {str(tmp_alarm_content.get("driver_name"))}, '
+ f'iotype: {str(tmp_alarm_content.get("io_type"))}, '
+ f'type: {str(tmp_alarm_content.get("alarm_type"))}, '
+ f'reason: {str(tmp_alarm_content.get("reason"))}')
logging.warning(f"latency: " + str(alarm_content.get("details").get("latency")))
logging.warning(f"iodump: " + str(alarm_content.get("details").get("iodump")))
diff --git a/src/python/sentryPlugins/ai_block_io/detector.py b/src/python/sentryPlugins/ai_block_io/detector.py
index 496e032..27fb7f7 100644
--- a/src/python/sentryPlugins/ai_block_io/detector.py
+++ b/src/python/sentryPlugins/ai_block_io/detector.py
@@ -58,11 +58,9 @@ class Detector:
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'metric: {self._metric_name.metric_name}, '
- f'current value: {metric_value}, '
- f'ai threshold: {detection_result[2]}, '
- f'absolute threshold upper limit: {detection_result[3]}, '
- f'lower limit: {detection_result[4]}')
+ f'type: {self._metric_name.metric_name}, '
+ f'ai_threshold: {round(detection_result[2], 3)}, '
+ f'curr_val: {metric_value}')
else:
logging.debug(f'Detection result: {str(detection_result)}')
logging.debug(f'exit Detector: {self}')
diff --git a/src/python/sentryPlugins/avg_block_io/stage_window.py b/src/python/sentryPlugins/avg_block_io/stage_window.py
index 5113782..587bd49 100644
--- a/src/python/sentryPlugins/avg_block_io/stage_window.py
+++ b/src/python/sentryPlugins/avg_block_io/stage_window.py
@@ -28,7 +28,7 @@ class AbnormalWindowBase:
self.abnormal_window.append(False)
def is_abnormal_window(self):
- return sum(self.abnormal_window) > self.window_threshold
+ return sum(self.abnormal_window) >= self.window_threshold
def window_data_to_string(self):
return ",".join(str(x) for x in self.window_data)
--
2.27.0