Ensure Go services expose /debug/pprof/ by importing net/http/pprof; if not using http.DefaultServeMux, register the handlers manually on your ServeMux
In your Grafana Alloy config file, define a pyroscope.write block pointing at the Pyroscope server or Grafana Cloud Profiles endpoint with appropriate authentication
Add a pyroscope.scrape block specifying targets with the host:port of each service, a service_name label, and any additional labels for environment and version
Under profiling_config, enable specific pprof profile types per target: profile.process_cpu, profile.godeltaprof_memory (preferred over heap for Go), profile.goroutine, as needed
Set scrape_interval in the pyroscope.scrape block to control how often profiles are fetched; 15s–60s is typical depending on overhead tolerance
In the Grafana Explore > Profiles view (or Pyroscope UI), select the service and profile type to render flamegraphs and diff profiles between time ranges or service versions
Known gotchas
Grafana Agent is deprecated (EOL November 2025) — use Grafana Alloy for new deployments; Alloy uses a different configuration syntax from the legacy Grafana Agent
The /debug/pprof/heap endpoint captures a snapshot at the moment of scrape; for Go, godeltaprof_memory captures allocations since the last scrape (delta profiling), which is more useful for identifying allocation hotspots over time
Scraping pprof endpoints has a non-trivial CPU cost on the target service, particularly for goroutine and heap profiles — test overhead in a staging environment before enabling all profile types in production
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp