profiling

package
v0.0.0-...-7983b3b Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProfileURLTemplate constant template for expected profiling endpoint URL.
	ProfileURLTemplate = "https://intake.profile.%s/v1/input"
	// ProfilingLocalURLTemplate is the constant used to compute the URL of the local trace agent
	ProfilingLocalURLTemplate = "http://%v/profiling/v1/input"
	// DefaultProfilingPeriod defines the default profiling period
	DefaultProfilingPeriod = 5 * time.Minute
)

Variables

This section is empty.

Functions

func GetBlockProfileRate

func GetBlockProfileRate() int

GetBlockProfileRate returns the current rate of goroutine blocking profile.

func GetMutexProfileFraction

func GetMutexProfileFraction() int

GetMutexProfileFraction returns the current fraction of mutexes that generate profile data.

func IsRunning

func IsRunning() bool

IsRunning returns true if the profiler is running; this function is thread-safe.

func SetBlockProfileRate

func SetBlockProfileRate(rate int)

SetBlockProfileRate sets goroutine blocking profile rate.

func SetMutexProfileFraction

func SetMutexProfileFraction(fraction int)

SetMutexProfileFraction sets fraction of mutexes that generate profiling data.

func Start

func Start(settings Settings) error

Start initiates profiling with the supplied parameters; this function is thread-safe.

func Stop

func Stop()

Stop stops the profiler if running - idempotent; this function is thread-safe.

Types

type Settings

type Settings struct {
	// Site specifies the datadog site (datadoghq.com, datadoghq.eu, etc.) which profiles will be sent to.
	Site string
	// Env specifies the environment to which profiles should be registered.
	Env string
	// Service specifies the service name to attach to a profile.
	Service string
	// Period specifies the interval at which to collect profiles.
	Period time.Duration
	// CPUDuration specifies the length at which to collect CPU profiles.
	CPUDuration time.Duration
	// MutexProfileFraction, if set, turns on mutex profiles with rate
	// indicating the fraction of mutex contention events reported in the mutex
	// profile.
	MutexProfileFraction int
	// BlockProfileRate turns on block profiles with the given rate.
	BlockProfileRate int
	// WithGoroutineProfile additionally reports stack traces of all current goroutines
	WithGoroutineProfile bool
	// Tags are the additional tags to attach to profiles.
	Tags []string
}

Settings contains the settings for internal profiling, to be passed to Start().

func (*Settings) String

func (settings *Settings) String() string

Jump to

Keyboard shortcuts

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