Skip to content

Commit

Permalink
added threshold for each metric
Browse files Browse the repository at this point in the history
Signed-off-by: Shashank Reddy Boyapally <[email protected]>
  • Loading branch information
shashank-boyapally committed Sep 16, 2024
1 parent 248893a commit 42ab354
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ tests :
labels:
- "[Jira: PerfScale]"
direction: 0
threshold: 10
- name: apiserverCPU
metricName : containerCPU
Expand All @@ -40,6 +41,7 @@ tests :
labels:
- "[Jira: kube-apiserver]"
direction: 0
threshold: 10
- name: ovnCPU
metricName : containerCPU
Expand All @@ -51,6 +53,7 @@ tests :
labels:
- "[Jira: Networking / ovn-kubernetes]"
direction: 0
threshold: 10
- name: etcdCPU
metricName : containerCPU
Expand All @@ -62,6 +65,7 @@ tests :
labels:
- "[Jira: etcd]"
direction: 0
threshold: 10
- name: etcdDisk
metricName : 99thEtcdDiskBackendCommitDurationSeconds
Expand All @@ -72,6 +76,7 @@ tests :
labels:
- "[Jira: etcd]"
direction: 0
threshold: 10
- name: kubelet
metricName : kubeletCPU
Expand All @@ -82,9 +87,10 @@ tests :
value: cpu
agg_type: avg
direction: 0
threshold: 10
```
**Note**: `direction: 1` specifies to show positive changes, `direction: 0` specifies to show both positive and negative changes while `direction: -1` shows negative changes.
**Note**: `direction: 1` specifies to show positive changes, `direction: 0` specifies to show both positive and negative changes while `direction: -1` shows negative changes. `threshold` is an absolute value, which allows only changepoints greater than a certain percentage to be detected.

## Build Orion
Building Orion is a straightforward process. Follow these commands:
Expand Down
3 changes: 2 additions & 1 deletion pkg/algorithms/edivisive/edivisive.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def _analyze(self):
for metric, changepoint_list in change_points_by_metric.items():
for i in range(len(changepoint_list)-1, -1, -1):
if ((self.metrics_config[metric]["direction"] == 1 and changepoint_list[i].stats.mean_1 > changepoint_list[i].stats.mean_2) or
(self.metrics_config[metric]["direction"] == -1 and changepoint_list[i].stats.mean_1 < changepoint_list[i].stats.mean_2) ):
(self.metrics_config[metric]["direction"] == -1 and changepoint_list[i].stats.mean_1 < changepoint_list[i].stats.mean_2) or
self.metrics_config[metric]["threshold"] > abs((changepoint_list[i].stats.mean_1 - changepoint_list[i].stats.mean_2)/changepoint_list[i].stats.mean_1)*100 ):
del changepoint_list[i]
if [val for li in change_points_by_metric.values() for val in li]:
self.regression_flag=True
Expand Down
3 changes: 2 additions & 1 deletion pkg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def get_metric_data(

labels = metric.pop("labels", None)
direction = int(metric.pop("direction", 0))

threshold = abs(int(metric.pop("threshold", 0)))
logger_instance.info("Collecting %s", metric_name)
try:
if "agg" in metric:
Expand All @@ -58,6 +58,7 @@ def get_metric_data(

metric["labels"] = labels
metric["direction"] = direction
metric["threshold"] = threshold
metrics_config[metric_dataframe_name] = metric
dataframe_list.append(metric_df)
logger_instance.debug(metric_df)
Expand Down

0 comments on commit 42ab354

Please sign in to comment.