[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] djm-logparser: improve output

Holger Levsen (@holger) gitlab at salsa.debian.org
Sun Apr 9 20:27:03 BST 2023



Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net


Commits:
a2a2ffe4 by Holger Levsen at 2023-04-09T21:25:21+02:00
djm-logparser: improve output

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


1 changed file:

- bin/djm-logparser


Changes:

=====================================
bin/djm-logparser
=====================================
@@ -17,10 +17,16 @@ set -o pipefail		# see eg http://petereisentraut.blogspot.com/2010/11/pipefail.h
 
 LOGFILE=~/.djm.log
 LOGMONTH="$(date -u '+%Y-%m')"
-THREE_C="%42s  %6s  %12s\n"
-TWO_C="%42s  %6s\n"
+THREE_C="%42s  %8s  %12s\n"
+TWO_C="%42s  %8s\n"
+ONE_C="%42s  %8s\n"
+
 seperator() {
-	echo "----------------------------------------------------------------"
+	local CHAR="${1:--}"
+	for i in $(seq 1 66) ; do
+		echo -n "$CHAR"
+	done
+	echo
 }
 
 #
@@ -39,37 +45,43 @@ SLICES_AS_HOURS=$(($TWENTY_MIN_SLICES/3))
 ACTIONS=$(cut -d ',' -f3 $LOGFILE | sort | sed 's#^#%#g'| uniq -c | sort -nr | cut -d '%' -f2| sed -s "s# #=#g")
 REASONS=$(cut -d ',' -f4 $LOGFILE | sort | sed 's#^#%#g'| uniq -c | sort -nr | cut -d '%' -f2| sed -s "s# #=#g")
 
-echo "Still very simple statistics for djm logs at $LOGFILE in $LOGMONTH"
+seperator "="
+echo "Still very simple statistics for djm logs at $LOGFILE"
 echo
 echo "djm = documented jenkins maintenance"
-echo "      jenkins.debian.net exists since 2012, djm since 2023-04"
+echo "      jenkins.debian.net exists since 2012, djm since 2023-04."
 echo "      so expect changes for some time."
-echo
-echo
+seperator "="
+printf "$TWO_C" "month:" "$LOGMONTH"
+seperator
 printf "$TWO_C" "djm actions:" "$TOTAL"
 printf "$TWO_C" "hosts maintained:" "$HOSTS"
 seperator
-printf "$TWO_C" "hours with djm usage:" "${HOURS}h"
+printf "$TWO_C" "hours with djm usage:" "${HOURS}"
 printf "$TWO_C" " ten minute slices with djm usage:" "$TEN_MIN_SLICES"
 printf "$TWO_C" " twenty minute slices (because focus):" "$TWENTY_MIN_SLICES"
-printf "$TWO_C" " thoses slices as hours:" "${SLICES_AS_HOURS}h"
-seperator
+printf "$TWO_C" " thoses slices as hours:" "${SLICES_AS_HOURS}"
+seperator "="
 
+printf "$ONE_C" "actions:"
+printf "$ONE_C" "--------"
 for action in $ACTIONS ; do
 	grep_action="$(echo $action | sed -s 's#=# #g' | xargs echo)"
 	AMOUNT=$(cut -d ',' -f3 $LOGFILE |grep "$grep_action"|wc -l)
 	PERCENT=$((200*$AMOUNT/$TOTAL % 2 + 100*$AMOUNT/$TOTAL))
-	printf "$THREE_C" "$grep_action actions:" "$PERCENT%" "($AMOUNT / $TOTAL)"
+	printf "$THREE_C" "$grep_action:" "$PERCENT%" "($AMOUNT / $TOTAL)"
 done
-seperator
+seperator "="
 
+printf "$ONE_C" "reasons:"
+printf "$ONE_C" "--------"
 for reason in $REASONS ; do
 	grep_reason="$(echo $reason | sed -s 's#=# #g' | xargs echo)"
 	AMOUNT=$(cut -d ',' -f4 $LOGFILE |grep "$grep_reason"|wc -l)
 	PERCENT=$((200*$AMOUNT/$TOTAL % 2 + 100*$AMOUNT/$TOTAL))
-	printf "$THREE_C" "$grep_reason reasons:" "$PERCENT%" "($AMOUNT / $TOTAL)"
+	printf "$THREE_C" "$grep_reason:" "$PERCENT%" "($AMOUNT / $TOTAL)"
 done
-seperator
+seperator "="
 
 # todo: sort actions and reasons by highest amount
 # todo: include the number of reproducible related jenkins jobs



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/a2a2ffe4380e06c6454951a7d4d828a564c9492c

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/a2a2ffe4380e06c6454951a7d4d828a564c9492c
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20230409/733abe40/attachment-0001.htm>


More information about the Qa-jenkins-scm mailing list