From 12f293aaf327b6a337873d914e00b2e7213d4fb9 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Mon, 21 Feb 2022 18:23:49 +0100 Subject: [PATCH] :robot: Add debug heap/goroutine collection script --- scripts/collect.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 scripts/collect.sh diff --git a/scripts/collect.sh b/scripts/collect.sh new file mode 100644 index 0000000..50f2bb1 --- /dev/null +++ b/scripts/collect.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Collect debug data. +# To run with edgevpn, run with --debug and --api flags on. +# Note: requires https://github.com/whyrusleeping/stackparse for parsing goroutine debug stacks + +mkdir collect +((count=1)) +while true; do + (( count = count + 1)) + curl http://localhost:8080/debug/pprof/heap > collect/heap$count + curl 'http://localhost:8080/debug/pprof/goroutine' > collect/goroutine$count + curl 'http://localhost:8080/debug/pprof/goroutine?debug=2' > collect/goroutine_debug_$count + stackparse --summary collect/goroutine_debug_$count > collect/goroutine_debug_${count}_summary + sleep 60 +done +