Skip to content

Commit 994be31

Browse files
committed
Add metric parsing scripts to generate additions/removals for complex changes.
These scripts hold some learnings on how to compare changes to the metric profile of the exporter. In future we'll teach travis to build this against master automatically and post a comment back to a PR with what's been changed. For now we just want to store them.
1 parent f6e4292 commit 994be31

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

postgres_metrics_added_and_removed

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
# Script to determine added and removed metrics.
3+
# Not currently used in CI but useful for inspecting complicated changes.
4+
5+
type=$1
6+
version=$2
7+
old_version=$3
8+
new_version=$4
9+
10+
comm -23 $old_version $new_version > .metrics.${type}.${version}.removed
11+
comm -13 $old_version $new_version > .metrics.${type}.${version}.added

postgres_metrics_parse_script

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
# Script to parse a text exposition format file into a unique list of metrics
3+
# output by the exporter.
4+
5+
# Not currently used for CI, but useful for inspecting the differences of
6+
# complicated PRs.
7+
8+
for raw_prom in $(echo .*.prom) ; do
9+
# Strip, sort and deduplicate the label names
10+
cat $raw_prom | grep -v '#' | \
11+
rev | cut -d' ' -f2- | \
12+
rev | cut -d'{' -f1 | \
13+
sort | \
14+
uniq > ${raw_prom}.unique
15+
16+
done

0 commit comments

Comments
 (0)