An eBPF tool monitoring a goroutine
gmon is a tool designed to monitor the creation and destruction of goroutines in a Go program, drawing inspiration from the presentation Real World Debugging with eBPF.
gmon uses BPF ring buffergmon uses fixed offset to get goroutine IDUsage of gmon:
-level string
log level could be one of ["DEBUG" "INFO" "WARN" "ERROR"] (default "INFO")
-metrics int
Port to be used for metrics server, /metrics endpoint (default 5500)
-path string
Path to executable file to be monitored (required)
-pid int
Useful when tracing programs that have many running instances
-pprof int
Port to be used for pprof server. If 0, pprof server is not started
-trace string
Path to Go runtime/trace outputhttps://github.com/keisku/gmon/assets/41987730/838fa12d-d622-4ad6-a9f0-6aab88acec55
gmon logs the creation of goroutines to stdout with stack traces.
…gmon exposes the following metrics in the OpenMetrics format on the GET /metrics.
gmon_goroutine_creationgmon_goroutine_exitgmon_goroutine_uptime…Follow the Docker installation guide to build and run tests.
# Build and output the binary to ./bin
./gmon.sh build
# Build and install the binary to /usr/bin
./gmon.sh install
# Run tests
./gmon.sh testNo open issues yet, or sync has not completed.