Documentation ¶
Overview ¶
Package profiler is a client for the Google Cloud Profiler service.
This package is still experimental and subject to change.
Calling Start will start a goroutine to collect profiles and upload to Cloud Profiler server, at the rhythm specified by the server.
The caller should provide the target string in the config so Cloud Profiler knows how to group the profile data. Otherwise the target string is set to "unknown".
Optionally DebugLogging can be set in the config to enable detailed logging from profiler.
Start should only be called once. The first call will start the profiling goroutine. Any additional calls will be ignored.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Start ¶
Start starts a goroutine to collect and upload profiles. See package level documentation for details.
Example ¶
package main import ( "cloud.google.com/go/profiler" ) func main() { // The caller should provide the target string in the config so Cloud // Profiler knows how to group the profile data. Otherwise the target // string is set to "unknown". // // Optionally DebugLogging can be set in the config to enable detailed // logging from profiler. err := profiler.Start(&profiler.Config{Target: "my-target"}) if err != nil { //TODO: Handle error. } }
Output:
Types ¶
type Config ¶
type Config struct { // Target groups related deployments together, defaults to "unknown". Target string // DebugLogging enables detailed debug logging from profiler. DebugLogging bool // ProjectID is the ID of the cloud project to use instead of // the one read from the VM metadata server. Typically for testing. ProjectID string // InstanceName is the name of the VM instance to use instead of // the one read from the VM metadata server. Typically for testing. InstanceName string // ZoneName is the name of the zone to use instead of // the one read from the VM metadata server. Typically for testing. ZoneName string // APIAddr is the HTTP endpoint to use to connect to the profiler // agent API. Defaults to the production environment, overridable // for testing. APIAddr string }
Config is the profiler configuration.