Go pprof Operations: Difference between revisions
Jump to navigation
Jump to search
Line 4: | Line 4: | ||
=Make Sure an Executable Starts with the Profiling Subsystem Enabled= | =Make Sure an Executable Starts with the Profiling Subsystem Enabled= | ||
<font color=darkkhaki>TODO</font> | <font color=darkkhaki>TODO</font> | ||
=TLS and Certificates= | |||
=Connect with a Browser to an Executable that Has the Profiling Subsystem Enabled= | |||
Go to https://127.0.0.1:8443/debug/pprof/ | |||
If the process has TLS enabled, see [[]] for suggestions on how to address the issue. | |||
=Profile a Running Process= | |||
Assuming that your local 127.0.0.1 address is aliased to "localhost.somedomain.com" in <code>/etc/hosts</code> and the certificates are issued for "localhost.somedomain.com", set <code>CERT_PATH</code> to the directory that contains <code></code> and <code></code> and: | |||
<syntaxhighlight lang='bash'> | |||
export CERT_PATH=/Users/ovidiu/some-project/config | |||
go tool pprof -http 127.0.0.1:8080 -tls_cert ${CERT_PATH}/localhost.somedomain.com.chain.pem -tls_key ${CERT_PATH}/localhost.somedomain.com.key.pem https://localhost.somedomain.com:8443 | |||
</syntaxhighlight> | |||
=Inspect a Running Process with a Browser= | |||
=Dump the Goroutines into a Text File= | |||
<syntaxhighlight lang='bash'> | |||
curl -k https://localhost:8443/debug/pprof/goroutine?debug=2 | |||
</syntaxhighlight> | |||
Replace the port with the actual HTTP(S) port the process is listening on. |
Revision as of 03:33, 16 November 2024
Internal
Make Sure an Executable Starts with the Profiling Subsystem Enabled
TODO
TLS and Certificates
Connect with a Browser to an Executable that Has the Profiling Subsystem Enabled
Go to https://127.0.0.1:8443/debug/pprof/
If the process has TLS enabled, see [[]] for suggestions on how to address the issue.
Profile a Running Process
Assuming that your local 127.0.0.1 address is aliased to "localhost.somedomain.com" in /etc/hosts
and the certificates are issued for "localhost.somedomain.com", set CERT_PATH
to the directory that contains and
and:
export CERT_PATH=/Users/ovidiu/some-project/config
go tool pprof -http 127.0.0.1:8080 -tls_cert ${CERT_PATH}/localhost.somedomain.com.chain.pem -tls_key ${CERT_PATH}/localhost.somedomain.com.key.pem https://localhost.somedomain.com:8443
Inspect a Running Process with a Browser
Dump the Goroutines into a Text File
curl -k https://localhost:8443/debug/pprof/goroutine?debug=2
Replace the port with the actual HTTP(S) port the process is listening on.