scrape

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProfilePath = "__profile_path__"
	ProfileName = "__name__"
)

Variables

View Source
var DefaultArguments = NewDefaultArguments()
View Source
var DefaultProfilingConfig = ProfilingConfig{
	Memory: ProfilingTarget{
		Enabled: true,
		Path:    "/debug/pprof/allocs",
	},
	Block: ProfilingTarget{
		Enabled: true,
		Path:    "/debug/pprof/block",
	},
	Goroutine: ProfilingTarget{
		Enabled: true,
		Path:    "/debug/pprof/goroutine",
	},
	Mutex: ProfilingTarget{
		Enabled: true,
		Path:    "/debug/pprof/mutex",
	},
	ProcessCPU: ProfilingTarget{
		Enabled: true,
		Path:    "/debug/pprof/profile",
		Delta:   true,
	},
	FGProf: ProfilingTarget{
		Enabled: false,
		Path:    "/debug/fgprof",
		Delta:   true,
	},

	GoDeltaProfMemory: ProfilingTarget{
		Enabled: false,
		Path:    "/debug/pprof/delta_heap",
	},
	GoDeltaProfMutex: ProfilingTarget{
		Enabled: false,
		Path:    "/debug/pprof/delta_mutex",
	},
	GoDeltaProfBlock: ProfilingTarget{
		Enabled: false,
		Path:    "/debug/pprof/delta_block",
	},
}

Functions

func LabelsByProfiles

func LabelsByProfiles(lset labels.Labels, c *ProfilingConfig) []labels.Labels

LabelsByProfiles returns the labels for a given ProfilingConfig.

func NewDeltaAppender

func NewDeltaAppender(appender pyroscope.Appender, labels labels.Labels) pyroscope.Appender

Types

type Arguments

type Arguments struct {
	Targets   []discovery.Target     `alloy:"targets,attr"`
	ForwardTo []pyroscope.Appendable `alloy:"forward_to,attr"`

	// The job name to override the job label with.
	JobName string `alloy:"job_name,attr,optional"`
	// A set of query parameters with which the target is scraped.
	Params url.Values `alloy:"params,attr,optional"`
	// How frequently to scrape the targets of this scrape config.
	ScrapeInterval time.Duration `alloy:"scrape_interval,attr,optional"`
	// The timeout for scraping targets of this config.
	ScrapeTimeout time.Duration `alloy:"scrape_timeout,attr,optional"`
	// The URL scheme with which to fetch metrics from targets.
	Scheme string `alloy:"scheme,attr,optional"`

	HTTPClientConfig component_config.HTTPClientConfig `alloy:",squash"`

	ProfilingConfig ProfilingConfig `alloy:"profiling_config,block,optional"`

	Clustering cluster.ComponentBlock `alloy:"clustering,block,optional"`
}

Arguments holds values which are used to configure the pprof.scrape component.

func NewDefaultArguments

func NewDefaultArguments() Arguments

NewDefaultArguments create the default settings for a scrape job.

func (*Arguments) SetToDefault

func (arg *Arguments) SetToDefault()

SetToDefault implements syntax.Defaulter.

func (*Arguments) Validate

func (arg *Arguments) Validate() error

Validate implements syntax.Validator.

type Component

type Component struct {
	// contains filtered or unexported fields
}

Component implements the pprof.scrape component.

func New

func New(o component.Options, args Arguments) (*Component, error)

New creates a new pprof.scrape component.

func (*Component) DebugInfo

func (c *Component) DebugInfo() interface{}

DebugInfo implements component.DebugComponent.

func (*Component) NotifyClusterChange

func (c *Component) NotifyClusterChange()

NotifyClusterChange implements component.ClusterComponent.

func (*Component) Run

func (c *Component) Run(ctx context.Context) error

Run implements component.Component.

func (*Component) Update

func (c *Component) Update(args component.Arguments) error

Update implements component.Component.

type CustomProfilingTarget

type CustomProfilingTarget struct {
	Enabled bool   `alloy:"enabled,attr"`
	Path    string `alloy:"path,attr"`
	Delta   bool   `alloy:"delta,attr,optional"`
	Name    string `alloy:",label"`
}

type DeltaProfiler

type DeltaProfiler interface {
	Delta(p []byte, out io.Writer) error
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(o Options, appendable pyroscope.Appendable, logger log.Logger) *Manager

func (*Manager) ApplyConfig

func (m *Manager) ApplyConfig(cfg Arguments) error

ApplyConfig resets the manager's target providers and job configurations as defined by the new cfg.

func (*Manager) Run

func (m *Manager) Run(tsets <-chan map[string][]*targetgroup.Group)

Run receives and saves target set updates and triggers the scraping loops reloading. Reloading happens in the background so that it doesn't block receiving targets updates.

func (*Manager) Stop

func (m *Manager) Stop()

func (*Manager) TargetsActive

func (m *Manager) TargetsActive() map[string][]*Target

TargetsActive returns the active targets currently being scraped.

func (*Manager) TargetsAll

func (m *Manager) TargetsAll() map[string][]*Target

TargetsAll returns active and dropped targets grouped by job_name.

func (*Manager) TargetsDropped

func (m *Manager) TargetsDropped() map[string][]*Target

TargetsDropped returns the dropped targets during relabelling.

type Options added in v1.1.0

type Options struct {
	// Optional HTTP client options to use when scraping.
	HTTPClientOptions []config_util.HTTPClientOption
}

type ProfilingConfig

type ProfilingConfig struct {
	Memory            ProfilingTarget         `alloy:"profile.memory,block,optional"`
	Block             ProfilingTarget         `alloy:"profile.block,block,optional"`
	Goroutine         ProfilingTarget         `alloy:"profile.goroutine,block,optional"`
	Mutex             ProfilingTarget         `alloy:"profile.mutex,block,optional"`
	ProcessCPU        ProfilingTarget         `alloy:"profile.process_cpu,block,optional"`
	FGProf            ProfilingTarget         `alloy:"profile.fgprof,block,optional"`
	GoDeltaProfMemory ProfilingTarget         `alloy:"profile.godeltaprof_memory,block,optional"`
	GoDeltaProfMutex  ProfilingTarget         `alloy:"profile.godeltaprof_mutex,block,optional"`
	GoDeltaProfBlock  ProfilingTarget         `alloy:"profile.godeltaprof_block,block,optional"`
	Custom            []CustomProfilingTarget `alloy:"profile.custom,block,optional"`

	PprofPrefix string `alloy:"path_prefix,attr,optional"`
}

func (*ProfilingConfig) AllTargets

func (cfg *ProfilingConfig) AllTargets() map[string]ProfilingTarget

AllTargets returns the set of all standard and custom profiling targets, regardless of whether they're enabled. The key in the map indicates the name of the target.

func (*ProfilingConfig) SetToDefault

func (cfg *ProfilingConfig) SetToDefault()

SetToDefault implements syntax.Defaulter.

type ProfilingTarget

type ProfilingTarget struct {
	Enabled bool   `alloy:"enabled,attr,optional"`
	Path    string `alloy:"path,attr,optional"`
	Delta   bool   `alloy:"delta,attr,optional"`
}

type Target

type Target struct {
	// contains filtered or unexported fields
}

Target refers to a singular HTTP or HTTPS endpoint.

func NewTarget

func NewTarget(lbls, discoveredLabels labels.Labels, params url.Values) *Target

NewTarget creates a reasonably configured target for querying.

func (*Target) Clone

func (t *Target) Clone() *Target

Clone returns a clone of the target.

func (*Target) DiscoveredLabels

func (t *Target) DiscoveredLabels() labels.Labels

DiscoveredLabels returns a copy of the target's labels before any processing.

func (*Target) Hash

func (t *Target) Hash() uint64

Hash returns an identifying hash for the target, based on public labels and the URL.

func (*Target) Health

func (t *Target) Health() TargetHealth

Health returns the last known health state of the target.

func (*Target) Labels

func (t *Target) Labels() labels.Labels

Labels returns the set of all public labels of the target. Callers must not modify the returned labels.

func (*Target) LastError

func (t *Target) LastError() error

LastError returns the error encountered during the last scrape.

func (*Target) LastScrape

func (t *Target) LastScrape() time.Time

LastScrape returns the time of the last scrape.

func (*Target) LastScrapeDuration

func (t *Target) LastScrapeDuration() time.Duration

LastScrapeDuration returns how long the last scrape of the target took.

func (*Target) Params

func (t *Target) Params() url.Values

Params returns a copy of the set of all public params of the target.

func (*Target) SetDiscoveredLabels

func (t *Target) SetDiscoveredLabels(l labels.Labels)

SetDiscoveredLabels sets new DiscoveredLabels.

func (*Target) String

func (t *Target) String() string

func (*Target) URL

func (t *Target) URL() string

URL returns the target's URL as string.

type TargetHealth

type TargetHealth string

TargetHealth describes the health state of a target.

const (
	HealthUnknown TargetHealth = "unknown"
	HealthGood    TargetHealth = "up"
	HealthBad     TargetHealth = "down"
)

The possible health states of a target based on the last performed scrape.

type Targets

type Targets []*Target

Targets is a sortable list of targets.

func (Targets) Len

func (ts Targets) Len() int

func (Targets) Less

func (ts Targets) Less(i, j int) bool

func (Targets) Swap

func (ts Targets) Swap(i, j int)

Directories

Path Synopsis
internal
fastdelta
Package fastdelta tries to match up samples between two pprof profiles and take their difference.
Package fastdelta tries to match up samples between two pprof profiles and take their difference.
pproflite
Package pproflite implements zero-allocation pprof encoding and decoding.
Package pproflite implements zero-allocation pprof encoding and decoding.

Jump to

Keyboard shortcuts

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