Skip to content

Commit

Permalink
Merge pull request #1020 from bharathappali/update-api-version
Browse files Browse the repository at this point in the history
Adds constants for each api version in kruize
  • Loading branch information
dinogun authored Nov 3, 2023
2 parents 5444752 + 53ac74f commit 1a6f9bf
Show file tree
Hide file tree
Showing 23 changed files with 596 additions and 445 deletions.
38 changes: 19 additions & 19 deletions design/MonitoringModeAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ see [Create Experiment](/design/CreateExperiment.md)
```json
[
{
"version": "1.0",
"version": "v2.0",
"experiment_name": "quarkus-resteasy-autotune-min-http-response-time-db",
"cluster_name": "cluster-one-division-bell",
"performance_profile": "resource-optimization-openshift",
Expand Down Expand Up @@ -192,7 +192,7 @@ see [Update results](/design/UpdateResults.md)
```json
[
{
"version": "1.0",
"version": "v2.0",
"experiment_name": "quarkus-resteasy-autotune-min-http-response-time-db",
"interval_start_time": "2022-01-23T18:25:43.511Z",
"interval_end_time": "2022-01-23T18:40:43.602Z",
Expand Down Expand Up @@ -589,7 +589,7 @@ Returns the latest result of all the experiments
```json
[
{
"version": "1.0",
"version": "v2.0",
"experiment_id": "f0007796e65c999d843bebd447c2fbaa6aaf9127c614da55e333cd6bdb628a74",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db_0",
"cluster_name": "cluster-one-division-bell",
Expand Down Expand Up @@ -724,7 +724,7 @@ Returns the latest result of all the experiments
...
...
{
"version": "1.0",
"version": "v2.0",
"experiment_id": "ab0a31a522cebdde52561482300d078ed1448fa7b75834fa216677d1d9d5cda6",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db_1",
"cluster_name": "cluster-one-division-bell",
Expand Down Expand Up @@ -801,7 +801,7 @@ Returns all the results of all the experiments
```json
[
{
"version": "1.0",
"version": "v2.0",
"experiment_id": "f0007796e65c999d843bebd447c2fbaa6aaf9127c614da55e333cd6bdb628a74",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db_0",
"cluster_name": "cluster-one-division-bell",
Expand Down Expand Up @@ -1056,7 +1056,7 @@ Returns the latest recommendations of all the experiments
```json
[
{
"version": "1.0",
"version": "v2.0",
"experiment_id": "f0007796e65c999d843bebd447c2fbaa6aaf9127c614da55e333cd6bdb628a74",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db_0",
"cluster_name": "cluster-one-division-bell",
Expand Down Expand Up @@ -1225,7 +1225,7 @@ Returns the latest recommendations of all the experiments
...
...
{
"version": "1.0",
"version": "v2.0",
"experiment_id": "ab0a31a522cebdde52561482300d078ed1448fa7b75834fa216677d1d9d5cda6",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db_1",
"cluster_name": "cluster-one-division-bell",
Expand Down Expand Up @@ -1323,7 +1323,7 @@ Returns all the recommendations of all the experiments
```json
[
{
"version": "1.0",
"version": "v2.0",
"experiment_id": "f0007796e65c999d843bebd447c2fbaa6aaf9127c614da55e333cd6bdb628a74",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db_0",
"cluster_name": "cluster-one-division-bell",
Expand Down Expand Up @@ -1679,7 +1679,7 @@ If no parameter is passed API returns all the latest recommendations available f
"container_image_name": "kruize/tfb-qrh:1.13.2.F_et17",
"container_name": "tfb-server-1",
"recommendations": {
"version": "1.0",
"version": "v2.0",
"notifications": {
"111000": {
"type": "info",
Expand Down Expand Up @@ -1878,7 +1878,7 @@ If no parameter is passed API returns all the latest recommendations available f
"container_image_name": "kruize/tfb-qrh:1.13.2.F_et17",
"container_name": "tfb-server-1",
"recommendations": {
"version": "1.0",
"version": "v2.0",
"notifications": {
"111000": {
"type": "info",
Expand Down Expand Up @@ -2099,7 +2099,7 @@ Returns the latest result of that experiment
"container_image_name": "kruize/tfb-qrh:1.13.2.F_et17",
"container_name": "tfb-server-1",
"recommendations": {
"version": "1.0",
"version": "v2.0",
"notifications": {
"111000": {
"type": "info",
Expand Down Expand Up @@ -2285,7 +2285,7 @@ Returns the latest result of that experiment
"container_image_name": "kruize/tfb-db:1.15",
"container_name": "tfb-server-0",
"recommendations": {
"version": "1.0",
"version": "v2.0",
"notifications": {
"120001": {
"type": "info",
Expand All @@ -2299,7 +2299,7 @@ Returns the latest result of that experiment
]
}
],
"version": "1.0",
"version": "v2.0",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db_0"
}
]
Expand Down Expand Up @@ -2337,7 +2337,7 @@ Returns all the results of that experiment
"container_image_name": "kruize/tfb-qrh:1.13.2.F_et17",
"container_name": "tfb-server-1",
"recommendations": {
"version": "1.0",
"version": "v2.0",
"notifications": {
"111000": {
"type": "info",
Expand Down Expand Up @@ -2646,7 +2646,7 @@ Returns all the results of that experiment
"container_image_name": "kruize/tfb-db:1.15",
"container_name": "tfb-server-0",
"recommendations": {
"version": "1.0",
"version": "v2.0",
"notifications": {
"120001": {
"type": "info",
Expand All @@ -2660,7 +2660,7 @@ Returns all the results of that experiment
]
}
],
"version": "1.0",
"version": "v2.0",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db_0"
}
]
Expand Down Expand Up @@ -2700,7 +2700,7 @@ Time - `2022-12-20T17:55:05.000Z`**
"container_image_name": "kruize/tfb-qrh:1.13.2.F_et17",
"container_name": "tfb-server-1",
"recommendations": {
"version": "1.0",
"version": "v2.0",
"notifications": {
"111000": {
"type": "info",
Expand Down Expand Up @@ -2885,7 +2885,7 @@ Time - `2022-12-20T17:55:05.000Z`**
]
}
],
"version": "1.0",
"version": "v2.0",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db_0"
}
]
Expand Down Expand Up @@ -3095,7 +3095,7 @@ The response will contain a array of JSON object with the updated recommendation
]
}
],
"version": "1.0",
"version": "v2.0",
"experiment_name": "temp_1"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public KruizeObject(String experimentName,

StringBuilder error = ValidateKruizeObject.validate(map);
if (error.toString().isEmpty()) {
this.apiVersion = AnalyzerConstants.VersionConstants.CURRENT_KRUIZE_OBJECT_VERSION;
this.experimentName = experimentName;
this.mode = mode;
this.targetCluster = targetCluster;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static ListRecommendationsAPIObject convertKruizeObjectToListRecommendati
Timestamp monitoringEndTime) {
ListRecommendationsAPIObject listRecommendationsAPIObject = new ListRecommendationsAPIObject();
try {
listRecommendationsAPIObject.setApiVersion(kruizeObject.getApiVersion());
listRecommendationsAPIObject.setApiVersion(AnalyzerConstants.VersionConstants.APIVersionConstants.CURRENT_LIST_RECOMMENDATIONS_VERSION);
listRecommendationsAPIObject.setExperimentName(kruizeObject.getExperimentName());
listRecommendationsAPIObject.setClusterName(kruizeObject.getClusterName());
List<KubernetesAPIObject> kubernetesAPIObjects = new ArrayList<>();
Expand Down Expand Up @@ -190,7 +190,7 @@ public static ListRecommendationsAPIObject convertKruizeObjectToListRecommendati
String monitoringEndTimestamp) {
ListRecommendationsAPIObject listRecommendationsAPIObject = new ListRecommendationsAPIObject();
try {
listRecommendationsAPIObject.setApiVersion(kruizeObject.getApiVersion());
listRecommendationsAPIObject.setApiVersion(AnalyzerConstants.VersionConstants.APIVersionConstants.CURRENT_LIST_RECOMMENDATIONS_VERSION);
listRecommendationsAPIObject.setExperimentName(kruizeObject.getExperimentName());
listRecommendationsAPIObject.setClusterName(kruizeObject.getClusterName());
List<KubernetesAPIObject> kubernetesAPIObjects = new ArrayList<>();
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/com/autotune/analyzer/utils/AnalyzerConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -531,4 +531,20 @@ private BooleanString() {

}
}

public static final class VersionConstants {
public static final class APIVersionConstants {
public static final String CURRENT_CREATE_EXPERIMENT_VERSION = "v2.0";
public static final String CURRENT_UPDATE_RESULTS_VERSION = "v2.0";
public static final String CURRENT_LIST_RECOMMENDATIONS_VERSION = "v2.0";
public static final String CURRENT_UPDATE_RECOMMENDATIONS_VERSION = "v2.0";
private APIVersionConstants() {

}
}
public static final String CURRENT_KRUIZE_OBJECT_VERSION = "v2.0";
private VersionConstants() {

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def create_exp_jsons(split = False, split_count = 1, exp_json_dir = "/tmp/exp_js

# Create a dictionary to hold the experiment data
experiment = {
"version": "1.0",
"version": "v2.0",
"experiment_name": exp_name + "_" + str(exp_num),
"cluster_name": cluster_name + "_" + str(exp_num),
"performance_profile": performance_profile,
Expand Down Expand Up @@ -299,7 +299,7 @@ def create_update_results_jsons(csv_file_path, split = False, split_count = 1, j

# Create a dictionary to hold the experiment data
update_results = {
"version": "1.0",
"version": "v2.0",
"experiment_name": exp_name + "_" + str(exp_num),
"interval_start_time": interval_start_time,
"interval_end_time": interval_end_time,
Expand Down
4 changes: 2 additions & 2 deletions tests/scripts/remote_monitoring_tests/helpers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@

# version,experiment_name,cluster_name,performance_profile,mode,target_cluster,type,name,namespace,container_image_name,container_name,measurement_duration,threshold
create_exp_test_data = {
"version": "1.0",
"version": "v2.0",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db",
"cluster_name": "cluster-one-division-bell",
"performance_profile": "resource-optimization-openshift",
Expand All @@ -111,7 +111,7 @@

# version, experiment_name,interval_start_time,interval_end_time,type,name,namespace,container_image_name,container_name,cpuRequest_name,cpuRequest_sum,cpuRequest_avg,cpuRequest_format,cpuLimit_name,cpuLimit_sum,cpuLimit_avg,cpuLimit_format,cpuUsage_name,cpuUsage_sum,cpuUsage_max,cpuUsage_avg,cpuUsage_min,cpuUsage_format,cpuThrottle_name,cpuThrottle_sum,cpuThrottle_max,cpuThrottle_avg,cpuThrottle_format,memoryRequest_name,memoryRequest_sum,memoryRequest_avg,memoryRequest_format,memoryLimit_name,memoryLimit_sum,memoryLimit_avg,memoryLimit_format,memoryUsage_name,memoryUsage_sum,memoryUsage_max,memoryUsage_avg,memUsage_min,memoryUsage_format,memoryRSS_name,memoryRSS_sum,memoryRSS_max,memoryRSS_avg,memoryRSS_min,memoryRSS_format
update_results_test_data = {
"version": "1.0",
"version": "v2.0",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db",
"interval_start_time": "2022-01-23T18:25:43.511Z",
"interval_end_time": "2022-01-23T18:40:43.511Z",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[{
"version": "1.0",
"version": "v2.0",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db",
"cluster_name": "cluster-one-division-bell",
"performance_profile": "resource-optimization-openshift",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{

"version": "1.0",
"version": "v2.0",
"cluster_name": "cluster-one-division-bell",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db",
"performance_profile": "resource-optimization-openshift",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"version": "1.0",
"version": "v2.0",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db-1",
"cluster_name": "cluster-one-division-bell",
"mode": "monitor",
Expand All @@ -27,7 +27,7 @@
}
},
{
"version": "1.0",
"version": "v2.0",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db-2",
"cluster_name": "cluster-one-division-bell",
"performance_profile": "resource-optimization-openshift",
Expand All @@ -54,7 +54,7 @@
}
},
{
"version": "1.0",
"version": "v2.0",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db-3",
"performance_profile": "resource-optimization-openshift",
"mode": "monitor",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"version": "1.0",
"version": "v2.0",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db-1",
"mode": "monitor",
"performance_profile": "resource-optimization-openshift",
Expand Down Expand Up @@ -34,7 +34,7 @@
}
},
{
"version": "1.0",
"version": "v2.0",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db-2",
"performance_profile": "resource-optimization-openshift",
"mode": "monitor",
Expand All @@ -60,7 +60,7 @@
}
},
{
"version": "1.0",
"version": "v2.0",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db-3",
"performance_profile": "resource-optimization-openshift",
"mode": "monitor",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"version": "1.0",
"version": "v2.0",
"experiment_name": "quarkus-resteasy-kruize-min-http-response-time-db",
"performance_profile": "resource-optimization-openshift",
"mode": "monitor",
Expand Down
Loading

0 comments on commit 1a6f9bf

Please sign in to comment.