From dcb31670d63235cdd0ff0de03fe283980ce4e543 Mon Sep 17 00:00:00 2001 From: Matt Layher Date: Tue, 13 Feb 2018 12:04:03 -0500 Subject: Makefile: add checkmetrics target, use in CI (#797) --- checkmetrics.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 checkmetrics.sh (limited to 'checkmetrics.sh') diff --git a/checkmetrics.sh b/checkmetrics.sh new file mode 100755 index 0000000..5d846cc --- /dev/null +++ b/checkmetrics.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +if [[ ( -z "$1" ) || ( -z "$2" ) ]]; then + echo "usage: ./checkmetrics.sh /usr/bin/promtool e2e-output.txt" + exit 1 +fi + +# Only check node_exporter's metrics, as the Prometheus Go client currently +# exposes a metric with a unit of microseconds. Once that is fixed, remove +# this filter. +lint=$($1 check metrics < $2 2>&1 | grep "node_") + +if [[ ! -z $lint ]]; then + echo -e "Some Prometheus metrics do not follow best practices:\n" + echo "$lint" + + exit 1 +fi \ No newline at end of file -- cgit v1.2.3