diff --git a/.gitignore b/.gitignore index 22bf9135..c159cb0a 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,6 @@ /*.prom /.metrics.*.*.prom /.metrics.*.*.prom.unique +/.assets-branch +/.metrics.*.added +/.metrics.*.removed diff --git a/postgres-metrics-get-changes.sh b/postgres-metrics-get-changes.sh index 24200ff1..85f40b95 100755 --- a/postgres-metrics-get-changes.sh +++ b/postgres-metrics-get-changes.sh @@ -11,14 +11,18 @@ function generate_add_removed() { old_version="$3" new_version="$4" + if [ ! -e "$old_version" ] ; then + touch "$old_version" + fi + comm -23 "$old_version" "$new_version" > ".metrics.${type}.${pg_version}.removed" comm -13 "$old_version" "$new_version" > ".metrics.${type}.${pg_version}.added" } for raw_prom in $(echo .*.prom) ; do # Get the type and version - type=$(cut -d'.' -f3) - pg_version=$(cut -d'.' -f4) + type=$(echo "$raw_prom" | cut -d'.' -f3) + pg_version=$(echo "$raw_prom" | cut -d'.' -f4- | sed 's/\.prom$//g') unique_file="${raw_prom}.unique" old_unique_file="$old_src/$unique_file"