To profile a OBI while it is instrumenting an application do the following:
-
Run OBI with the
OTEL_EBPF_PROFILE_PORTvariable set, e.g. 6060. -
Download the required profiles:
curl -o <profile> http://localhost:6060/debug/pprof/<profile>
Where
<profile>can be:allocs: a sample of all past memory allocationsblock: stack traces that led to blocking on synchronization primitivescmdline: the command to run the program to profilegoroutine: stack traces of all current goroutinesheap: a sample of memory allocations of live objects- provide an optional
gcquery parameter to run the GC before sampling the heap
- provide an optional
mutex: stack traces of holders of contended mutexesprofile: CPU profile- provide an optional
durationquery parameter in seconds
- provide an optional
threadcreate: stack traces that led to the creation of new OS threadstrace: a trace of execution of the current program- provide an optional
durationquery parameter in seconds
- provide an optional
Example:
curl "http://localhost:6060/debug/pprof/trace?seconds=20" -o trace20s curl "http://localhost:6060/debug/pprof/profile?duration=20" -o profile20s curl "http://localhost:6060/debug/pprof/heap?gc" -o heap curl "http://localhost:6060/debug/pprof/allocs" -o allocs curl "http://localhost:6060/debug/pprof/goroutine" -o goroutine
-
Use
go tool pprofto dig into the profiles (go tool tracefortraceprofiles)