profiler

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2017 License: Apache-2.0 Imports: 27 Imported by: 0

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

func Start(cfg Config, options ...option.ClientOption) error

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 Cloud Console project ID to use instead of
	// the one read from the VM metadata server.
	//
	// Set this if you are running the agent in your local environment
	// or anywhere else outside of Google Cloud Platform.
	ProjectID string

	// InstanceName is the name of the VM instance to use instead of
	// the one read from the VM metadata server.
	//
	// Set this if you are running the agent in your local environment
	// or anywhere else outside of Google Cloud Platform.
	InstanceName string

	// ZoneName is the name of the zone to use instead of
	// the one read from the VM metadata server.
	//
	// Set this if you are running the agent in your local environment
	// or anywhere else outside of Google Cloud Platform.
	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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL