The agent exposes pprof endpoints for profiling. The following endpoints are available and require basic authentication to access them:

  • /debug/pprof/
  • /debug/pprof/cmdline
  • /debug/pprof/profile
  • /debug/pprof/symbol
  • /debug/pprof/trace

To enable profiling, set the pprof configuration option in the agent configuration file. The agent will then expose the pprof endpoints protected by basic authentication.

See Configuration for more information on how to configure the agent.

{
  "pprof": {
    "username": "PPROF_USERNAME",
    "password": "PPROF_PASSWORD"
  }
}

There are some helper scripts available in the agent repository to interact with the pprof endpoints. The scripts are located in the /apps/agent/scripts directory.

These scripts are specific to our setup on fly.io and serve as an example. They should work for any setup with minor modifications.

After running, your browser should open automatically and the pprof web interface allows you to analyze the profile data.

Profiling the cpu

cd apps/agent
set PPROF_USERNAME=XXX
set PPROF_PASSWORD=XXX 
set MACHINE_ID=XXX 

bash ./scripts/profile.bash

Profiling memory

cd apps/agent
set PPROF_USERNAME=XXX
set PPROF_PASSWORD=XXX 
set MACHINE_ID=XXX 

bash ./scripts/heap.bash

Was this page helpful?