Fix test-tools metrics script 95/140395/1
authordanielhanrahan <daniel.hanrahan@est.tech>
Wed, 5 Mar 2025 10:15:46 +0000 (10:15 +0000)
committerdanielhanrahan <daniel.hanrahan@est.tech>
Thu, 6 Mar 2025 16:34:37 +0000 (16:34 +0000)
The test script for generating spreadsheet report from prometheus
metrics is currently broken (produces garbage output).

- Issue is fixed by specifying space character as delimiter.
- Add more metrics to the report to make script more useful.

Issue-ID: CPS-2651
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: I6347521f15bdfc1654243552bfe87190058bd8db

test-tools/generate-metrics-report.sh

index 7d94e5b..4d99adf 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# Copyright 2023 Nordix Foundation.
+# Copyright 2023-2025 Nordix Foundation.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -75,13 +75,13 @@ function generate_report() {
   grep --invert-match "^#" $TEMP_DIR/metrics-raw.txt | sort | sed 's/,[}]/}\t/' >$TEMP_DIR/metrics-all.txt
 
   # Extract useful metrics.
-  grep -E "^cps_|^spring_data_" $TEMP_DIR/metrics-all.txt >$TEMP_DIR/metrics-cps.txt
+  grep -E "^cps_|^spring_data_|^http_server_|^http_client_|^tasks_scheduled_execution_|^spring_kafka_template_|^spring_kafka_listener_" $TEMP_DIR/metrics-all.txt >$TEMP_DIR/metrics-cps.txt
 
   # Extract into columns.
-  grep "_count" $TEMP_DIR/metrics-cps.txt | sed 's/_count//' | cut -f 1 >$TEMP_DIR/column1.txt
-  grep "_count" $TEMP_DIR/metrics-cps.txt | cut -f 2 >$TEMP_DIR/column2.txt
-  grep "_sum"   $TEMP_DIR/metrics-cps.txt | cut -f 2 >$TEMP_DIR/column3.txt
-  grep "_max"   $TEMP_DIR/metrics-cps.txt | cut -f 2 >$TEMP_DIR/column4.txt
+  grep "_count" $TEMP_DIR/metrics-cps.txt | sed 's/_count//' | cut -d ' ' -f 1 >$TEMP_DIR/column1.txt
+  grep "_count" $TEMP_DIR/metrics-cps.txt | cut -d ' ' -f 2 >$TEMP_DIR/column2.txt
+  grep "_sum"   $TEMP_DIR/metrics-cps.txt | cut -d ' ' -f 2 >$TEMP_DIR/column3.txt
+  grep "_max"   $TEMP_DIR/metrics-cps.txt | cut -d ' ' -f 2 >$TEMP_DIR/column4.txt
 
   # Combine columns into report.
   paste $TEMP_DIR/column{1,2,3,4}.txt >$TEMP_DIR/report.txt