Search code examples
gojwtpprof

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


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.


Solution

  • 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