From a9e2f8a8d15754feca7db70782fa0567771a7f92 Mon Sep 17 00:00:00 2001 From: Shreya Date: Thu, 5 Dec 2024 13:50:41 +0530 Subject: [PATCH 1/2] Add metadata profile in the existing demo flow --- monitoring/local_monitoring/common.sh | 31 ++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/monitoring/local_monitoring/common.sh b/monitoring/local_monitoring/common.sh index 98da9af1..1c6506cf 100755 --- a/monitoring/local_monitoring/common.sh +++ b/monitoring/local_monitoring/common.sh @@ -45,9 +45,32 @@ function kruize_local_metric_profile() { fi } +function kruize_local_metadata_profile() { + + # Metadata Profile JSON + cluster_metadata_local_monitoring="${current_dir}/autotune/manifests/autotune/metadata-profiles/cluster-metadata-local-monitoring.json" + + { + echo + echo "######################################################" + echo "# Install default metadata profile" + echo "######################################################" + echo + output=$(curl -X POST http://${KRUIZE_URL}/createMetadataProfile -d @$cluster_metadata_local_monitoring) + echo + } >> "${LOG_FILE}" 2>&1 + + if [[ "$output" != *"SUCCESS"* ]]; then + echo $output >> "${LOG_FILE}" 2>&1 + false + check_err "Error. Unable to create metadata profile. Exiting!" + fi +} + function kruize_local_metadata() { export DATASOURCE="prometheus-1" export CLUSTER_NAME="default" + export METADATA_PROFILE="cluster-metadata-local-monitoring" { echo echo "######################################################" @@ -66,7 +89,9 @@ function kruize_local_metadata() { --header 'Content-Type: application/json' \ --data '{ "version": "v1.0", - "datasource_name": "prometheus-1" + "datasource_name": "prometheus-1", + "metadata_profile": "cluster-metadata-local-monitoring", + "measurement_duration": "15" }') # Exit if unable to connect to datasource @@ -438,6 +463,10 @@ function kruize_local_demo_setup() { kruize_local_metric_profile echo "✅ Installation of metric profile complete!" + echo -n "🔄 Installing metadata profile..." + kruize_local_metadata_profile + echo "✅ Installation of metadata profile complete!" + if [ ${demo} == "local" ]; then echo -n "🔄 Collecting metadata..." kruize_local_metadata From 61858399db98bb80633b8adafaa7c9b1f3ac4abb Mon Sep 17 00:00:00 2001 From: Shreya Date: Thu, 5 Dec 2024 13:58:00 +0530 Subject: [PATCH 2/2] Update createExp templates adding metadat_profile field --- monitoring/local_monitoring/experiments/experiment_template.json | 1 + .../experiments/namespace_experiment_template.json | 1 + 2 files changed, 2 insertions(+) diff --git a/monitoring/local_monitoring/experiments/experiment_template.json b/monitoring/local_monitoring/experiments/experiment_template.json index 26aa4dc7..b7a61752 100644 --- a/monitoring/local_monitoring/experiments/experiment_template.json +++ b/monitoring/local_monitoring/experiments/experiment_template.json @@ -3,6 +3,7 @@ "experiment_name": "monitor_container_PLACEHOLDER_CONTAINER", "cluster_name": "default", "performance_profile": "resource-optimization-local-monitoring", + "metadata_profile": "cluster-metadata-local-monitoring", "mode": "monitor", "target_cluster": "local", "datasource": "prometheus-1", diff --git a/monitoring/local_monitoring/experiments/namespace_experiment_template.json b/monitoring/local_monitoring/experiments/namespace_experiment_template.json index 62b7e1a7..43822757 100644 --- a/monitoring/local_monitoring/experiments/namespace_experiment_template.json +++ b/monitoring/local_monitoring/experiments/namespace_experiment_template.json @@ -3,6 +3,7 @@ "experiment_name": "monitor_namespace_PLACEHOLDER_NAMESPACE_NAME", "cluster_name": "default", "performance_profile": "resource-optimization-local-monitoring", + "metadata_profile": "cluster-metadata-local-monitoring", "mode": "monitor", "target_cluster": "local", "datasource": "prometheus-1",