Get pprof Dumps (Backend) #
Hit the pod’s IP directly over WARP.
Needs the gcloud CLI and WARP connected — the GKE pod ranges are published WARP routes, so a pod IP is reachable from your laptop.
1. Get the pod names and IPs #
kubectl --context=<context> \
-n fs-apps get pods -l app=backend \
-o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.podIP}{"\n"}{end}'
Use the context gcloud setup generated for the environment you want. Naming it on the command line keeps the environment unambiguous — see name the context.
2. Pull a dump #
The backend serves pprof on port 8001.
List what is available:
curl http://<pod-ip>:8001/debug/pprof/
Then take the profile you need:
# 30s CPU profile — for high CPU
go tool pprof http://<pod-ip>:8001/debug/pprof/profile?seconds=30
# heap snapshot — for growing memory
go tool pprof http://<pod-ip>:8001/debug/pprof/heap
# goroutine dump — for hangs and deadlocks
curl http://<pod-ip>:8001/debug/pprof/goroutine?debug=2 -o goroutines.txt
3. Read it #
go tool pprof drops you into an interactive shell:
top # hottest functions
list <func> # line-by-line cost
web # call graph, needs Graphviz
Related #
- GKE diagnostics — pick the right pod first
- Grafana — confirm the symptom before you profile
Next: run the staging pod-list command, then curl http://<pod-ip>:8001/debug/pprof/.