From: halil.cakal Date: Tue, 17 Sep 2024 14:53:09 +0000 (+0100) Subject: k6 historical graphs X-Git-Url: https://gerrit.nordix.org/gitweb?a=commitdiff_plain;h=b02a315e4b4a74cad4de4855a5a0929b3d9cceb3;p=infra%2Fcicd.git k6 historical graphs - add weekly and monthly (historical) plots for k6 performance tests Issue-ID: CPS-2404 Change-Id: I4391cdb9c1ec75bdcca74b2b59cdf43f905c076c Signed-off-by: halil.cakal --- diff --git a/jjb/onap/cps/prepare-k6-performance-tests-plots.sh b/jjb/onap/cps/prepare-k6-performance-tests-plots.sh index c8a82821..90c29b43 100755 --- a/jjb/onap/cps/prepare-k6-performance-tests-plots.sh +++ b/jjb/onap/cps/prepare-k6-performance-tests-plots.sh @@ -66,14 +66,14 @@ getAndRecordPerformanceJobResultForBuild() { if [ -s summary.csv ]; then # Store the test cases, names, and units cut -d, -f1,2,3 summary.csv > test-cases.csv - # Process each row in the CSV, storing the limit and actual value for this build - while IFS=, read -r test_case test_name units limit actual; do - echo "$buildNumber,$limit,$actual" >> "data/$test_case.csv" + # Process each row in the CSV, storing the limit cps_expectation and actual value for this build + while IFS=, read -r test_case test_name units limit cps_expectation actual; do + echo "$buildNumber,$limit,$cps_expectation,$actual" >> "data/$test_case.csv" done < summary.csv else # No CSV data for this build, so record zeroes for this build in each existing data file for dataFile in data/*.csv; do - echo "$buildNumber,0,0" >> "$dataFile" + echo "$buildNumber,0,0,0" >> "$dataFile" done fi recordLatestRecordedBuild "$buildNumber" @@ -93,6 +93,7 @@ buildPlotImage() { dataFile="$1" chartFileName="$2" units="$3" + numberOfBuilds="$4" y_max=$(findMaxPlotRange "$dataFile") @@ -116,11 +117,28 @@ set grid ytics ls 1 set xtics rotate # Use plot command with explicit column assignments and lines for all series -plot '$dataFile' using 1:2 with lines linestyle 2 title "threshold", \ - '$dataFile' using 1:3 with lines linestyle 3 title "cps-limit", \ - '$dataFile' using 1:4:xtic(1) with linespoints linestyle 4 title "measured" EOT + if [ "$numberOfBuilds" -eq 100 ]; then + cat <>gnuplot_script.gp +plot '<(tail -n $numberOfBuilds $dataFile)' using 1:2 with lines linestyle 2 title "threshold", \ + '<(tail -n $numberOfBuilds $dataFile)' using 1:3 with lines linestyle 3 title "cps-limit", \ + '<(tail -n $numberOfBuilds $dataFile)' using 1:4:xtic(1) with linespoints linestyle 4 title "measured" +EOT + elif [ "$numberOfBuilds" -eq 168 ]; then + cat <>gnuplot_script.gp +plot '<(tail -n $numberOfBuilds $dataFile | awk "NR % 2 == 0")' using 1:2 with lines linestyle 2 title "threshold", \ + '<(tail -n $numberOfBuilds $dataFile | awk "NR % 2 == 0")' using 1:3 with lines linestyle 3 title "cps-limit", \ + '<(tail -n $numberOfBuilds $dataFile | awk "NR % 2 == 0")' using 1:4:xtic(1) with linespoints linestyle 4 title "measured" +EOT + elif [ "$numberOfBuilds" -eq 720 ]; then + cat <>gnuplot_script.gp +plot '<(tail -n $numberOfBuilds $dataFile | awk "NR % 7 == 0")' using 1:2 with lines linestyle 2 title "threshold", \ + '<(tail -n $numberOfBuilds $dataFile | awk "NR % 7 == 0")' using 1:3 with lines linestyle 3 title "cps-limit", \ + '<(tail -n $numberOfBuilds $dataFile | awk "NR % 7 == 0")' using 1:4:xtic(1) with linespoints linestyle 4 title "measured" +EOT + fi + # Run the temporary Gnuplot script gnuplot gnuplot_script.gp @@ -142,6 +160,53 @@ findMaxPlotRange() { print max * 1.2; }' "$dataFile" } + +generateHtmlReport() { + local reportTitle="$1" + local outputFile="$2" + local numberOfBuilds="$3" + + cat <"$outputFile" + + + + $reportTitle + + +

$reportTitle

+

Last updated for performance job build no. $latestRecordedBuild on $formattedTimestampOfLatestRecordedBuild

+ +EOT + + # Loop through the tests to generate the HTML rows which consists of the plot-image + while IFS=, read -r test_case test_name units; do + dataFile="data/$test_case.csv" + # Plot the image (graph) in png format + buildPlotImage "$dataFile" "data/${test_case}_${numberOfBuilds}.png" "$units" "$numberOfBuilds" + # Output to HTML + cat <>"$outputFile" + + + +EOF + done < test-cases.csv + + # Close the HTML file + cat <>"$outputFile" +
+
$test_case. $test_name ($units)
+ +
+

The plots are generated from the output of the Nordix Jenkins job: + onap-cps-performance-test-k6.

+

The k6 performance tests run are described in the + NCMP REST Interface Characteristics documentation.

+ + +EOT +} + + ############################################################################################################################# ################################################ M A I N #################################################################### ############################################################################################################################# @@ -173,45 +238,14 @@ else fi fi -reportTitle="k6 tests performance review" -outputFile="k6TestsPerformanceReview.html" -cat <"$outputFile" - - - - $reportTitle - - -

$reportTitle

-

Last updated for performance job build no. $latestRecordedBuild on $formattedTimestampOfLatestRecordedBuild

- -EOT +reportTitleDaily="daily k6 tests performance review" +outputFileDaily="k6TestsPerformanceReview.html" +generateHtmlReport "$reportTitleDaily" "$outputFileDaily" "100" -# Loop through the tests to generate the HTML rows which consists of the plot-image -while IFS=, read -r test_case test_name units; do - dataFile="data/$test_case.csv" - # Limit the plots to last 100 builds for each test - tail -n 100 "$dataFile" > file.tmp && mv file.tmp "$dataFile" - # Plot image files in png format - buildPlotImage "$dataFile" "data/$test_case.png" "$units" - # Output to HTML - cat <>"$outputFile" - - - -EOF -done < test-cases.csv +reportTitleWeekly="weekly k6 tests performance review" +outputFileWeekly="k6TestsPerformanceReviewWeekly.html" +generateHtmlReport "$reportTitleWeekly" "$outputFileWeekly" "168" -# Close the HTML file -cat <>"$outputFile" -
-
$test_case. $test_name ($units)
- -
-

The plots are generated from the output of the Nordix Jenkins job: - onap-cps-performance-test-k6.

-

The k6 performance tests run are described in the - NCMP REST Interface Characteristics documentation.

- - -EOT +reportTitleMonthly="monthly k6 tests performance review" +outputFileMonthly="k6TestsPerformanceReviewMonthly.html" +generateHtmlReport "$reportTitleMonthly" "$outputFileMonthly" "720"