fix: allow profiling of remote node via https
License: MIT Signed-off-by: Oli Evans <oli@tableflip.io>
Oli Evans committed
Jan 16, 2020 at 14:19 UTC
982bc38a512420a6ee6ee4d2a3e9ab1b28bbfdbe
1 file changed
+9
-9
bin/collect-profiles.sh
+9
-9
@@ -12,7 +12,7 @@
12
set -euo pipefail
13
IFS=$'\n\t'
14
15
-HTTP_API="${1:-127.0.0.1:5001}"
15
+SOURCE_URL="${1:-http://127.0.0.1:5001}"
16
tmpdir=$(mktemp -d)
17
export PPROF_TMPDIR="$tmpdir"
18
pushd "$tmpdir" > /dev/null
@@ -22,27 +22,27 @@ if command -v ipfs > /dev/null 2>&1; then
22
fi
23
24
echo Collecting goroutine stacks
25
-curl -s -o goroutines.stacks "http://$HTTP_API"'/debug/pprof/goroutine?debug=2'
25
+curl -s -o goroutines.stacks "$SOURCE_URL"'/debug/pprof/goroutine?debug=2'
26
27
echo Collecting goroutine profile
28
-go tool pprof -symbolize=remote -svg -output goroutine.svg "http://$HTTP_API/debug/pprof/goroutine"
28
+go tool pprof -symbolize=remote -svg -output goroutine.svg "$SOURCE_URL/debug/pprof/goroutine"
29
30
echo Collecting heap profile
31
-go tool pprof -symbolize=remote -svg -output heap.svg "http://$HTTP_API/debug/pprof/heap"
31
+go tool pprof -symbolize=remote -svg -output heap.svg "$SOURCE_URL/debug/pprof/heap"
32
33
echo "Collecting cpu profile (~30s)"
34
-go tool pprof -symbolize=remote -svg -output cpu.svg "http://$HTTP_API/debug/pprof/profile"
34
+go tool pprof -symbolize=remote -svg -output cpu.svg "$SOURCE_URL/debug/pprof/profile"
35
36
echo "Enabling mutex profiling"
37
-curl -X POST "http://$HTTP_API"'/debug/pprof-mutex/?fraction=4'
37
+curl -X POST "$SOURCE_URL"'/debug/pprof-mutex/?fraction=4'
38
39
echo "Waiting for mutex data to be updated (30s)"
40
sleep 30
41
-curl -s -o mutex.txt "http://$HTTP_API"'/debug/pprof/mutex?debug=2'
42
-go tool pprof -symbolize=remote -svg -output mutex.svg "http://$HTTP_API/debug/pprof/mutex"
41
+curl -s -o mutex.txt "$SOURCE_URL"'/debug/pprof/mutex?debug=2'
42
+go tool pprof -symbolize=remote -svg -output mutex.svg "$SOURCE_URL/debug/pprof/mutex"
43
44
echo "Disabling mutex profiling"
45
-curl -X POST "http://$HTTP_API"'/debug/pprof-mutex/?fraction=0'
45
+curl -X POST "$SOURCE_URL"'/debug/pprof-mutex/?fraction=0'
46
47
OUTPUT_NAME=ipfs-profile-$(uname -n)-$(date +'%Y-%m-%dT%H:%M:%S%z').tar.gz
48
echo "Creating $OUTPUT_NAME"