syntasso / kratix

Kratix is an open-source framework for building platforms
https://kratix.io
Apache License 2.0
423 stars 23 forks source link

feat: serve pprof #168

Closed ChunyiLyu closed 1 week ago

ChunyiLyu commented 2 weeks ago

Context

Setting PprofBindAddress in manager options to serve pprof.

To use:

  1. port forward the controller pod
  2. collect a profile
  3. visualize:
    
    ❯ k -n kratix-platform-system port-forward pod/kratix-platform-controller-manager-5c4df4bc77-wtp6z 8082:8082

❯ curl -s "http://127.0.0.1:8082/debug/pprof/heap" > ./heap.out

❯ go tool pprof -http=:8080 ./heap.out Serving web UI on http://localhost:8080



Then you can get CPU time, heap, flamegraph...etc
<img width="1125" alt="Screenshot 2024-06-14 at 16 39 06" src="https://github.com/syntasso/kratix/assets/6786193/813885c0-d4c6-4794-ba71-582989565473">
kirederik commented 1 week ago

@ChunyiLyu i rebased this pr with latest main -- hopefully ci will go green 🤞🏽