Skip to content

Commit

Permalink
ci: Check metrics names
Browse files Browse the repository at this point in the history
  • Loading branch information
mahendrapaipuri committed Nov 15, 2023
1 parent bc6358b commit 889db7a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions checkmetrics.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

if [[ ( -z "$1" ) || ( -z "$2" ) ]]; then
echo "usage: ./checkmetrics.sh /usr/bin/promtool e2e-test-output.txt"
exit 1
fi

# Ignore known issues in auto-generated and network specific collectors.
lint=$($1 check metrics < "$2" 2>&1 | grep -v -E "^batchjob_(memory_fail_count|memsw_fail_count)")

if [[ -n $lint ]]; then
echo -e "Some Prometheus metrics do not follow best practices:\n"
echo "$lint"

exit 1
fi

0 comments on commit 889db7a

Please sign in to comment.