profiling

package
v0.0.0-...-f8e543c Latest Latest
Warning

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

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

Documentation

Overview

Package profiling interacts with internal profiling

Index

Constants

View Source
const (
	// ProfilingURLTemplate constant template for expected profiling endpoint URL.
	ProfilingURLTemplate = "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"
)

Variables

This section is empty.

Functions

func GetBlockProfileRate added in v0.9.0

func GetBlockProfileRate() int

GetBlockProfileRate returns the current rate of goroutine blocking profile.

func GetMutexProfileFraction added in v0.9.0

func GetMutexProfileFraction() int

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

func IsRunning added in v0.9.0

func IsRunning() bool

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

func SetBlockProfileRate added in v0.9.0

func SetBlockProfileRate(rate int)

SetBlockProfileRate sets goroutine blocking profile rate.

func SetMutexProfileFraction added in v0.9.0

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 added in v0.9.0

type Settings struct {
	// Socket specifies a unix socket to which profiles will be sent.
	Socket string
	// ProfilingURL specifies the URL to which profiles will be sent in
	// agentless mode. This can be constructed from a site value with
	// ProfilingURLTemplate.
	ProfilingURL 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
	// WithBlockProfile additionally enables block profiling
	WithBlockProfile bool
	// WithMutexProfile additionally enables mutex profiling
	WithMutexProfile bool
	// WithDeltaProfiles specifies if delta profiles are enabled
	WithDeltaProfiles bool
	// Tags are the additional tags to attach to profiles.
	Tags []string
	// CustomAttributes names of goroutine labels to use as custom attributes in Datadog Profiling UI
	CustomAttributes []string
}

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

func (*Settings) String added in v0.9.0

func (settings *Settings) String() string

Jump to

Keyboard shortcuts

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