Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrorFunc func(err error)
ErrorFunc is an optional error handler for any errors raised while collecting profiles. If not set, errors will be silently ignored (the default).
Functions ¶
func Disable ¶
func Disable()
Disable prevents the next CPU profile from being run, but if a profile is already in progress then that profile will be submitted. That profile runner will not be rescheduled, however.
func Enable ¶
Enable begins CPU profiling with the given interval and sampleSize. The first profile will begin after 1 interval. After the interval, the CPU profile will begin buffering for sampleSize amount of time. Once sampleSize is elapsed, the CPU profile is stopped and submitted to the given endpoint.
Only after the profile is fully submitted to the endpoint will another wait for interval begins. That is, the time between profiles is `interval + sampleSize + submission time`.
Any encountered errors during the profile and submission will be sent to ErrorFunc.
Enable implies a call to Disable first.
Types ¶
type CollectorEndpoint ¶
type CollectorEndpoint struct { Endpoint // contains filtered or unexported fields }
CollectorEndpoint is an Endpoint compatible with pgo-fleet's `collector` process.
func NewCollectorEndpoint ¶
func NewCollectorEndpoint(apiUrl string, authKey string) (*CollectorEndpoint, error)
NewCollectorEndpoint creates a new Endpoint compatible with pgo-fleet's `collector` process. The API URL is the URL to HTTP POST the profile to upon submission, and the authKey will be provided in the Authentication header.
An error is only returned if the given URL is invalid in some way.