Skip to content
Snippets Groups Projects
Unverified Commit df0bb41a authored by Will Rouesnel's avatar Will Rouesnel
Browse files

Add metric change tracking scripts.

parent a2a2a1df
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -22,6 +22,8 @@ after_success:
; docker push wrouesnel/postgres_exporter:$TRAVIS_TAG ; fi
- if [ "$TRAVIS_BRANCH" == "master" ]; then docker push wrouesnel/postgres_exporter
; fi
- ./postgres-metrics-get-changes.sh
- if [ "$TRAVIS_BRANCH" == "support_shell_fixes" ]; then ./gh-metrics-push.sh ; fi
env:
global:
- DOCKER_USER=wrouesnel
Loading
Loading
Loading
Loading
@@ -2,8 +2,8 @@
# Script to setup the assets clone of the repository using GIT_ASSETS_BRANCH and
# GIT_API_KEY.
 
[ -z "$GIT_ASSETS_BRANCH" ] || exit 1
[ -z "$GIT_API_KEY" ] || exit 1
[ ! -z "$GIT_ASSETS_BRANCH" ] || exit 1
[ ! -z "$GIT_API_KEY" ] || exit 1
 
setup_git() {
git config --global user.email "travis@travis-ci.org" || exit 1
Loading
Loading
#!/bin/bash
# Script to copy and push new metric versions to the assets branch.
[ ! -z "$GIT_ASSETS_BRANCH" ] || exit 1
[ ! -z "$GIT_API_KEY" ] || exit 1
version=$(git describe HEAD) || exit 1
# Constants
ASSETS_DIR=".assets-branch"
METRICS_DIR="$ASSETS_DIR/metriclists"
# Ensure metrics dir exists
mkdir -p "$METRICS_DIR/"
# Remove old files so we spot deletions
rm -f "$METRICS_DIR/*.unique"
# Copy new files
cp -f -t "$METRICS_DIR/" ./*.unique || exit 1
# Enter the assets dir and push.
cd "$ASSETS_DIR" || exit 1
git add "$METRICS_DIR" || exit 1
git commit -m "Added unique metrics for build from $version" || exit 1
git push origin "$GIT_ASSETS_BRANCH" || exit 1
exit 0
\ No newline at end of file
#!/bin/bash
# Script to parse a text exposition format file into a unique list of metrics
# output by the exporter.
# output by the exporter and then build lists of added/removed metrics.
 
# Not currently used for CI, but useful for inspecting the differences of
# complicated PRs.
old_src="$1"
[ ! -e "$old_src" ] && exit 1
function generate_add_removed() {
type="$1"
pg_version="$2"
old_version="$3"
new_version="$4"
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)
unique_file="${raw_prom}.unique"
old_unique_file="$old_src/$unique_file"
# Strip, sort and deduplicate the label names
grep -v '#' "$raw_prom" | \
rev | cut -d' ' -f2- | \
rev | cut -d'{' -f1 | \
sort | \
uniq > "${raw_prom}.unique"
uniq > "$unique_file"
generate_add_removed "$type" "$pg_version" "$old_unique_file" "$unique_file"
done
#!/bin/bash
# Script to determine added and removed metrics.
# Not currently used in CI but useful for inspecting complicated changes.
# valid types: single or replicated
type="$1"
pg_version="$2"
old_version="$3"
new_version="$4"
comm -23 "$old_version" "$new_version" > ".metrics.${type}.${pg_version}.removed"
comm -13 "$old_version" "$new_version" > ".metrics.${type}.${pg_version}.added"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment