diff options
author | Aleksander Mistewicz <a.mistewicz@samsung.com> | 2017-06-13 12:20:15 +0200 |
---|---|---|
committer | Aleksander Mistewicz <a.mistewicz@samsung.com> | 2017-08-08 10:18:08 +0200 |
commit | 69e5b7dc2e8093d2cfb10a7cf4618b940d9f5437 (patch) | |
tree | ad0a22e28c43fda806abf2706601d20e08acac6b | |
parent | 78ce9bc5bc2644bb1362d6ab01b7eeaf3c4482fc (diff) | |
download | major-69e5b7dc2e8093d2cfb10a7cf4618b940d9f5437.tar.gz major-69e5b7dc2e8093d2cfb10a7cf4618b940d9f5437.tar.bz2 major-69e5b7dc2e8093d2cfb10a7cf4618b940d9f5437.zip |
Log running time to Prometheus
Change-Id: I23d3f8ad05d22b1578457ecca29a6e677b65e095
-rwxr-xr-x | tsp/watchers/watch_target_queues.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tsp/watchers/watch_target_queues.sh b/tsp/watchers/watch_target_queues.sh index 5380484..2d4df31 100755 --- a/tsp/watchers/watch_target_queues.sh +++ b/tsp/watchers/watch_target_queues.sh @@ -19,10 +19,21 @@ export TSP_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)/.." . "${TSP_DIR}/common.sh" +TIMES_NAME="tsrun_time" +TIMES="$(mktemp)" +{ + echo "# HELP $TIMES_NAME Execution time of the most recent command" + echo "# TYPE $TIMES_NAME gauge" +} > "$TIMES" + for ltarget in $TARGET_LIST do target="${ltarget#*-}" COUNT="$(tsrun_target "${target}" | grep queued | wc -l)" # Report queue length post_prom "tsrun_queued_${target}" "$COUNT" "Length of ${target} queue" + TIME="$(tsrun_target "${target}" -i | grep -o "[0-9]\+\.[0-9]\+")" + echo "${TIMES_NAME}{target=\"${ltarget}\"} $TIME" >> "$TIMES" #FIXME use real target instead of l-target done + +mv "$TIMES" "$PROM_DIR/tsrun_times.prom" |