Optimize infer rule config
This commit is contained in:
parent
88083e8157
commit
ec9bd4ae50
82
0002-optimize-infer-rule-config.patch
Normal file
82
0002-optimize-infer-rule-config.patch
Normal file
@ -0,0 +1,82 @@
|
||||
From aeec448c24f3d724a8b79a9732091d8a833cedc5 Mon Sep 17 00:00:00 2001
|
||||
From: algorithmofdish <hexiujun1@huawei.com>
|
||||
Date: Fri, 16 Dec 2022 17:04:51 +0800
|
||||
Subject: [PATCH] refactor(infer): optimize infer rule config
|
||||
|
||||
---
|
||||
README.md | 2 +-
|
||||
cause_inference/causal_graph.py | 7 +++++++
|
||||
cause_inference/output.py | 2 +-
|
||||
config/infer-rule.yaml | 5 +----
|
||||
4 files changed, 10 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/README.md b/README.md
|
||||
index 91d8afe..422ae86 100644
|
||||
--- a/README.md
|
||||
+++ b/README.md
|
||||
@@ -198,7 +198,7 @@ gala-spider 项目提供了两个功能模块,它们分别是:
|
||||
- prometheus_server :指定 Prometheus 服务器地址
|
||||
- arangodb_server :指定 arangodb 服务器地址
|
||||
- kafka_server :指定 kafka 服务器地址
|
||||
- - log_level :指定 gala-spider 日志打印级别
|
||||
+ - log_level :指定 gala-inference 日志打印级别
|
||||
|
||||
此外,如果需要从宿主机的配置文件中启动容器,可通过挂载卷的方式执行:
|
||||
|
||||
diff --git a/cause_inference/causal_graph.py b/cause_inference/causal_graph.py
|
||||
index f429bd6..10ad3ba 100644
|
||||
--- a/cause_inference/causal_graph.py
|
||||
+++ b/cause_inference/causal_graph.py
|
||||
@@ -67,6 +67,13 @@ class CausalGraph:
|
||||
else:
|
||||
abn_metrics[abn_metric.abnormal_metric_id] = abn_metric.to_dict()
|
||||
|
||||
+ metric_labels = abn_metrics[abn_metric.abnormal_metric_id].get('metric_labels')
|
||||
+ if not metric_labels:
|
||||
+ metric_labels = dict(node_attrs.get('raw_data', {}))
|
||||
+ if 'metrics' in metric_labels:
|
||||
+ metric_labels.pop('metrics')
|
||||
+ abn_metrics[abn_metric.abnormal_metric_id].update({'metric_labels': metric_labels})
|
||||
+
|
||||
def get_abnormal_metrics(self, node_id) -> dict:
|
||||
return self.entity_cause_graph.nodes[node_id].get('abnormal_metrics', {})
|
||||
|
||||
diff --git a/cause_inference/output.py b/cause_inference/output.py
|
||||
index 983b10c..51b9a54 100644
|
||||
--- a/cause_inference/output.py
|
||||
+++ b/cause_inference/output.py
|
||||
@@ -39,7 +39,7 @@ def format_cause_metrics(causes: List[Cause]):
|
||||
'metric_labels': node_attrs.get('metric_labels', {}),
|
||||
'timestamp': node_attrs.get('timestamp'),
|
||||
'desc': node_attrs.get('desc'),
|
||||
- 'score': node_attrs.get('corr_score', 0.0),
|
||||
+ 'score': cause.cause_score,
|
||||
'keyword': cause_keyword_mgt.get_keyword_of_entity(node_attrs.get('entity_type')),
|
||||
}
|
||||
path = []
|
||||
diff --git a/config/infer-rule.yaml b/config/infer-rule.yaml
|
||||
index e88db7b..d5d1b51 100644
|
||||
--- a/config/infer-rule.yaml
|
||||
+++ b/config/infer-rule.yaml
|
||||
@@ -10,10 +10,6 @@ metric_categories:
|
||||
metrics:
|
||||
- gala_gopher_proc_read_bytes
|
||||
- gala_gopher_proc_write_bytes
|
||||
- - gala_gopher_proc_less_4k_io_read
|
||||
- - gala_gopher_proc_less_4k_io_write
|
||||
- - gala_gopher_proc_greater_4k_io_read
|
||||
- - gala_gopher_proc_greater_4k_io_write
|
||||
trend: rise
|
||||
-
|
||||
category: PROC_IO_DELAY
|
||||
@@ -49,6 +45,7 @@ metric_categories:
|
||||
- gala_gopher_block_latency_req_last
|
||||
- gala_gopher_block_latency_req_sum
|
||||
- gala_gopher_block_latency_req_jitter
|
||||
+ - gala_gopher_block_count_latency_req
|
||||
nic:
|
||||
-
|
||||
category: NIC_DROP
|
||||
--
|
||||
2.21.0.windows.1
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
Name: gala-spider
|
||||
Version: 1.0.1
|
||||
Release: 2
|
||||
Release: 3
|
||||
Summary: OS topological graph storage service and cause inference service for gala-ops project
|
||||
License: MulanPSL2
|
||||
URL: https://gitee.com/openeuler/gala-spider
|
||||
@ -12,6 +12,7 @@ BuildRequires: python3-setuptools systemd
|
||||
Requires: python3-%{name} = %{version}-%{release}
|
||||
|
||||
patch0: 0001-optimize-cause-location-with-time-delay.patch
|
||||
patch1: 0002-optimize-infer-rule-config.patch
|
||||
|
||||
|
||||
%description
|
||||
@ -124,6 +125,9 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Dec 21 2022 algorithmofdish <hexiujun1@huawei.com> - 1.0.1-3
|
||||
- Optimize infer rule config
|
||||
|
||||
* Thu Dec 15 2022 algorithmofdish <hexiujun1@huawei.com> - 1.0.1-2
|
||||
- Optimize cause location with time delay
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user