Repository navigation
Debug
Daniel Carbone edited this page Nov 6, 2026
·
1 revision
$consul->Debug fetches Go pprof profiles from an agent's /debug/pprof endpoints. The agent must be running with
enable_debug = true, or in -dev mode. The ACL token needs operator:read.
Each method returns the raw profile bytes as a string, which you can write to disk and inspect with go tool pprof:
[$heap, $err] = $consul->Debug->Heap();
if (null === $err) {
file_put_contents('heap.prof', $heap);
}
// CPU profile collected over 10 seconds
[$cpu, $err] = $consul->Debug->Profile(seconds: 10);
file_put_contents('cpu.prof', $cpu);Profile() and Trace() block for the requested number of seconds, so make sure your HTTP client timeout is longer
than that. Goroutine() and PProf(name:, seconds:) are also available.
See Responses and Errors.