mirror of
https://github.com/safing/portbase
synced 2025-09-01 10:09:50 +00:00
Improve profiling API endpoint docs
This commit is contained in:
parent
eda7a122db
commit
52a2a1f673
1 changed files with 29 additions and 15 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
"runtime/pprof"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/safing/portbase/utils/debug"
|
||||
|
@ -48,7 +49,12 @@ func registerDebugEndpoints() error {
|
|||
Read: PermitAnyone,
|
||||
DataFunc: handleCPUProfile,
|
||||
Name: "Get CPU Profile",
|
||||
Description: "",
|
||||
Description: strings.ReplaceAll(`Gather and return the CPU profile.
|
||||
This data needs to gathered over a period of time, which is specified using the duration parameter.
|
||||
|
||||
You can easily view this data in your browser with this command (with Go installed):
|
||||
"go tool pprof -http :8888 http://127.0.0.1:817/api/v1/debug/cpu"
|
||||
`, `"`, "`"),
|
||||
Parameters: []Parameter{{
|
||||
Method: http.MethodGet,
|
||||
Field: "duration",
|
||||
|
@ -64,7 +70,11 @@ func registerDebugEndpoints() error {
|
|||
Read: PermitAnyone,
|
||||
DataFunc: handleHeapProfile,
|
||||
Name: "Get Heap Profile",
|
||||
Description: "",
|
||||
Description: strings.ReplaceAll(`Gather and return the heap memory profile.
|
||||
|
||||
You can easily view this data in your browser with this command (with Go installed):
|
||||
"go tool pprof -http :8888 http://127.0.0.1:817/api/v1/debug/heap"
|
||||
`, `"`, "`"),
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -74,7 +84,11 @@ func registerDebugEndpoints() error {
|
|||
Read: PermitAnyone,
|
||||
DataFunc: handleAllocsProfile,
|
||||
Name: "Get Allocs Profile",
|
||||
Description: "",
|
||||
Description: strings.ReplaceAll(`Gather and return the memory allocation profile.
|
||||
|
||||
You can easily view this data in your browser with this command (with Go installed):
|
||||
"go tool pprof -http :8888 http://127.0.0.1:817/api/v1/debug/allocs"
|
||||
`, `"`, "`"),
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue