Specify jwt token when fetch profile via "go tool pprof"

641 Views Asked by At

My api is protected via jwt, is it possible to specify a jwt token when fetch profile via go tool pprof ?

Currently, I have to config jwt middleware to bypass the /debug/pprof routes.

1

There are 1 best solutions below

4
Cyprian On BEST ANSWER

I couldn't find a way to pass a token via go tool pprof directly, but due to the fact that you can use curl to fetch the profile, there is a simple workaround:

$ curl -o profile.out https://host/debug/pprof -H 'X-Authorization: $TOKEN'
$ go tool pprof profile.out