Enable pprof route for nakama typescript runtime

I’m looking to understand the cpu usage in my custom rpc functions within the nakama typescript runtime and the runtime itself. I saw that you have pprof routes defined here:

but I don’t know how to access this api to understand the profiling. I have a 4 cpu machine running docker compose but it seems like its using a large amount of cpu for the nakama process when creating / starting / joining matches (even idle).

For additional context I’m running it with godot 3 clients connecting.

Please let me know how to debug this and enable pprof. Thank you.

Hello @lukep,

You don’t need to do anything special to enable pprof, it’ll be available at the path in the snippet you shared, under the console port (default should be 7351), just use a pprof client to that URL with basic auth using the console credentials and it should work.

It should look something like:

go tool pprof --pdf http://admin:password@localhost:7351/debug/pprof/profile_js > pprof_out.pd