From 982bc38a512420a6ee6ee4d2a3e9ab1b28bbfdbe Mon Sep 17 00:00:00 2001 From: Oli Evans Date: Thu, 16 Jan 2020 14:19:58 +0000 Subject: [PATCH] fix: allow profiling of remote node via https License: MIT Signed-off-by: Oli Evans --- bin/collect-profiles.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/collect-profiles.sh b/bin/collect-profiles.sh index 07e454d41..eba6495f8 100755 --- a/bin/collect-profiles.sh +++ b/bin/collect-profiles.sh @@ -12,7 +12,7 @@ set -euo pipefail IFS=$'\n\t' -HTTP_API="${1:-127.0.0.1:5001}" +SOURCE_URL="${1:-http://127.0.0.1:5001}" tmpdir=$(mktemp -d) export PPROF_TMPDIR="$tmpdir" pushd "$tmpdir" > /dev/null @@ -22,27 +22,27 @@ if command -v ipfs > /dev/null 2>&1; then fi echo Collecting goroutine stacks -curl -s -o goroutines.stacks "http://$HTTP_API"'/debug/pprof/goroutine?debug=2' +curl -s -o goroutines.stacks "$SOURCE_URL"'/debug/pprof/goroutine?debug=2' echo Collecting goroutine profile -go tool pprof -symbolize=remote -svg -output goroutine.svg "http://$HTTP_API/debug/pprof/goroutine" +go tool pprof -symbolize=remote -svg -output goroutine.svg "$SOURCE_URL/debug/pprof/goroutine" echo Collecting heap profile -go tool pprof -symbolize=remote -svg -output heap.svg "http://$HTTP_API/debug/pprof/heap" +go tool pprof -symbolize=remote -svg -output heap.svg "$SOURCE_URL/debug/pprof/heap" echo "Collecting cpu profile (~30s)" -go tool pprof -symbolize=remote -svg -output cpu.svg "http://$HTTP_API/debug/pprof/profile" +go tool pprof -symbolize=remote -svg -output cpu.svg "$SOURCE_URL/debug/pprof/profile" echo "Enabling mutex profiling" -curl -X POST "http://$HTTP_API"'/debug/pprof-mutex/?fraction=4' +curl -X POST "$SOURCE_URL"'/debug/pprof-mutex/?fraction=4' echo "Waiting for mutex data to be updated (30s)" sleep 30 -curl -s -o mutex.txt "http://$HTTP_API"'/debug/pprof/mutex?debug=2' -go tool pprof -symbolize=remote -svg -output mutex.svg "http://$HTTP_API/debug/pprof/mutex" +curl -s -o mutex.txt "$SOURCE_URL"'/debug/pprof/mutex?debug=2' +go tool pprof -symbolize=remote -svg -output mutex.svg "$SOURCE_URL/debug/pprof/mutex" echo "Disabling mutex profiling" -curl -X POST "http://$HTTP_API"'/debug/pprof-mutex/?fraction=0' +curl -X POST "$SOURCE_URL"'/debug/pprof-mutex/?fraction=0' OUTPUT_NAME=ipfs-profile-$(uname -n)-$(date +'%Y-%m-%dT%H:%M:%S%z').tar.gz echo "Creating $OUTPUT_NAME"