From 28fb6ddbfec830f2b5c3f2dc831e39ca6558284b Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 7 Jan 2023 18:56:55 +0100 Subject: [PATCH] sql inspections --- Inspection/Sql/performance.sh | 9 +++++++++ Inspection/inspect.sh | 8 ++++++++ setup.sh | 2 ++ 3 files changed, 19 insertions(+) create mode 100644 Inspection/Sql/performance.sh diff --git a/Inspection/Sql/performance.sh b/Inspection/Sql/performance.sh new file mode 100644 index 0000000..b14daa0 --- /dev/null +++ b/Inspection/Sql/performance.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +. config.sh + +# Mysql required with query logging +# sudo apt-get install percona-toolkit +mysqldumpslow -t 10 /var/log/mysql/mysql-slow.log > ${INSPECTION_PATH}/Sql/slow_queries.log +mysqldumpslow -t 10 -s l /var/log/mysql/mysql-slow.log > ${INSPECTION_PATH}/Sql/locked_queries.log +pt-query-digest /var/log/mysql/mysql-slow.log > ${INSPECTION_PATH}/Sql/query_details.log \ No newline at end of file diff --git a/Inspection/inspect.sh b/Inspection/inspect.sh index edd95e8..098262c 100755 --- a/Inspection/inspect.sh +++ b/Inspection/inspect.sh @@ -20,6 +20,14 @@ echo "#################################################" . ${BUILD_PATH}/Inspection/Php/tests.sh +# Executing query inspections AFTER the unit test which also runs queries +# This requires MYSQL with query logging enabled +echo "#################################################" +echo "MYSQL queries" +echo "#################################################" + +. ${BUILD_PATH}/Inspection/Sql/performance.sh + # Stats & metrics echo "#################################################" echo "PHP stats" diff --git a/setup.sh b/setup.sh index 6157d3c..7f1ce52 100755 --- a/setup.sh +++ b/setup.sh @@ -93,6 +93,8 @@ mkdir -p ${INSPECTION_PATH}/Test/Php mkdir -p ${INSPECTION_PATH}/Test/Js mkdir -p ${INSPECTION_PATH}/Test/sitespeed +mkdir -p ${INSPECTION_PATH}/Sql + # Permission handling chmod -R 777 ${ROOT_PATH}