From 7bce8eb4562367de8ba62ba7f74342528cc3c9db Mon Sep 17 00:00:00 2001
From: David Georg Reichelt <davidgeorg_reichelt@dagere.de>
Date: Wed, 18 Aug 2021 17:46:31 +0200
Subject: [PATCH] Move zipkin / prometheus start to common-functions.sh

---
 frameworks/common-functions.sh        | 30 +++++++++++++++++++++++++++
 frameworks/inspectIT/benchmark.sh     | 18 ----------------
 frameworks/opentelemetry/benchmark.sh | 17 ---------------
 3 files changed, 30 insertions(+), 35 deletions(-)

diff --git a/frameworks/common-functions.sh b/frameworks/common-functions.sh
index ab783d7..f283288 100644
--- a/frameworks/common-functions.sh
+++ b/frameworks/common-functions.sh
@@ -47,6 +47,36 @@ function createRLabels() {
 	echo $LABELS
 }
 
+function startZipkin {
+	if [ ! -d zipkin ]
+	then
+		mkdir zipkin
+		cd zipkin
+		curl -sSL https://zipkin.io/quickstart.sh | bash -s
+	else
+		cd zipkin
+	fi
+	java -Xmx6g -jar zipkin.jar &> zipkin.txt &
+	sleep 5
+	cd ..
+}
+
+function startPrometheus {
+	if [ ! -d prometheus-2.28.1.linux-amd64 ]
+	then
+		wget https://github.com/prometheus/prometheus/releases/download/v2.28.1/prometheus-2.28.1.linux-amd64.tar.gz
+		tar -xvf prometheus-2.28.1.linux-amd64.tar.gz
+		rm prometheus-2.28.1.linux-amd64.tar.gz
+	fi
+	cd prometheus-2.28.1.linux-amd64
+	./prometheus &> prometheus.log &
+	cd ..
+}
+
+function stopBackgroundProcess {
+	kill %1
+}
+
 function writeConfiguration() {
 	uname -a >${RESULTS_DIR}configuration.txt
 	${JAVABIN}java ${JAVAARGS} -version 2>>${RESULTS_DIR}configuration.txt
diff --git a/frameworks/inspectIT/benchmark.sh b/frameworks/inspectIT/benchmark.sh
index 79327cf..161d8bb 100755
--- a/frameworks/inspectIT/benchmark.sh
+++ b/frameworks/inspectIT/benchmark.sh
@@ -34,24 +34,6 @@ function runInspectITZipkin {
     stopBackgroundProcess
 }
 
-function startZipkin {
-	if [ ! -d zipkin ]
-	then
-		mkdir zipkin
-		cd zipkin
-		curl -sSL https://zipkin.io/quickstart.sh | bash -s
-	else
-		cd zipkin
-	fi
-	java -Xmx6g -jar zipkin.jar &> zipkin.txt &
-	sleep 5
-	cd ..
-}
-
-function stopBackgroundProcess {
-	kill %1
-}
-
 function cleanup {
 	[ -f ${BASEDIR}hotspot.log ] && mv ${BASEDIR}hotspot.log ${RESULTSDIR}hotspot-${i}-${j}-${k}.log
 	echo >>${BASEDIR}inspectit.log
diff --git a/frameworks/opentelemetry/benchmark.sh b/frameworks/opentelemetry/benchmark.sh
index 4a6fa32..9599267 100755
--- a/frameworks/opentelemetry/benchmark.sh
+++ b/frameworks/opentelemetry/benchmark.sh
@@ -14,19 +14,6 @@ function startZipkin {
 	cd ..
 }
 
-function startPrometheus {
-	if [ ! -d prometheus-2.28.1.linux-amd64 ]
-	then
-		wget https://github.com/prometheus/prometheus/releases/download/v2.28.1/prometheus-2.28.1.linux-amd64.tar.gz
-		tar -xvf prometheus-2.28.1.linux-amd64.tar.gz
-		rm prometheus-2.28.1.linux-amd64.tar.gz
-	fi
-	cd prometheus-2.28.1.linux-amd64
-	./prometheus &> prometheus.log &
-	cd ..
-}
-
-
 function startJaeger {
 	if [ ! -d jaeger-1.24.0-linux-amd64 ]
 	then
@@ -39,10 +26,6 @@ function startJaeger {
 	cd ..
 }
 
-function stopBackgroundProcess {
-	kill %1
-}
-
 function cleanup {
 	[ -f ${BASEDIR}hotspot.log ] && mv ${BASEDIR}hotspot.log ${RESULTS_DIR}hotspot-${i}-$RECURSION_DEPTH-${k}.log
 	echo >>${BASEDIR}opentelemetry.log
-- 
GitLab