Skip to content

wzxjohn/pprof-web

Repository files navigation

PProf-Web

Docker Image CI

PProd web is a web proxy for pprof endpoints. Sometimes we have firewalls between net areas and cannot retch the pprof debug endpoint directly. PProf-Web can be deployed in this area and expose only one web endpoint to proxy the pprof request.

Goals

  • ONLY use official pprof tool as go mod dependency
  • Implement interfaces in official pprof tool as little as possible

Feature

  • Fetch remote CPU profile
  • Load profile from local tmp storage
  • Auto delete inactive profile
  • Better log
  • Dockerfile
  • Helm chart
  • Unit test
  • Support heap profile
  • Support goroutine profile
  • Improve web UI
  • Proxy for all pprof endpoint
  • Support sub folder using -b param

Usage

Nginx proxy as sub folder

Be careful of the proxy_read_timeout option. Because server cannot send any response data during profile, this option must larger than max profile seconds (usually 60s).

location /cluster-1/ {
    rewrite ^/cluster-1(/.*)$ $1 break;
    proxy_redirect / /cluster-1/;
    proxy_read_timeout 120s;
    proxy_pass http://1.1.1.1:8080/;
}

location /cluster-2/ {
    rewrite ^/cluster-2(/.*)$ $1 break;
    proxy_redirect / /cluster-2/;
    proxy_read_timeout 120s;
    proxy_pass http://2.2.2.2:8080/;
}

Stargazers over time

Stargazers over time