This package provide ability to enable on demand continuous profiling on a Go process
Similar to pprof
in order to use the profiler one should export the profiler package for side effects:
_ "github.com/omerglam/goprobe"
The package will register a new endpoint(/profiler/toggle
) on the default server mux that allows to toggle on\off
the profiler.
To toggle the profiler ON: execute an HTTP POST request to the profiler/toggle
endpoint with the next request body:
curl -X POST -d '{"applicationName":"my-app", "collectorAddress": "http://pyroscope.o11y:4040", "tags":{"namespace": "app-namespace"}}' 127.0.0.1:6061/profiler/toggle
where:
- collectorAddress
- represent the pyroscope server address
- applicationName
- name that will be used in the pyroscope
- tags
- key value pairs for additional metadata on pyroscope
To toggle the profiler OFF:
curl -X POST 127.0.0.1:6061/profiler/toggle
The package will create a http server listing on localhost:6061 and will accept only request coming from local address