Documentation
¶
Index ¶
- Constants
- Variables
- func LabelsByProfiles(lset labels.Labels, c *ProfilingConfig) []labels.Labels
- func NewDeltaAppender(appender pyroscope.Appender, labels labels.Labels) pyroscope.Appender
- type Arguments
- type Component
- type CustomProfilingTarget
- type DeltaProfiler
- type Manager
- func (m *Manager) ApplyConfig(cfg Arguments) error
- func (m *Manager) Run(tsets <-chan map[string][]*targetgroup.Group)
- func (m *Manager) Stop()
- func (m *Manager) TargetsActive() map[string][]*Target
- func (m *Manager) TargetsAll() map[string][]*Target
- func (m *Manager) TargetsDropped() map[string][]*Target
- type ProfilingConfig
- type ProfilingTarget
- type Target
- func (t *Target) Clone() *Target
- func (t *Target) DiscoveredLabels() labels.Labels
- func (t *Target) Hash() uint64
- func (t *Target) Health() TargetHealth
- func (t *Target) Labels() labels.Labels
- func (t *Target) LastError() error
- func (t *Target) LastScrape() time.Time
- func (t *Target) LastScrapeDuration() time.Duration
- func (t *Target) Params() url.Values
- func (t *Target) SetDiscoveredLabels(l labels.Labels)
- func (t *Target) String() string
- func (t *Target) URL() string
- type TargetHealth
- type Targets
Constants ¶
const (
ProfilePath = "__profile_path__"
ProfileName = "__name__"
)
Variables ¶
var DefaultArguments = NewDefaultArguments()
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 ¶ added in v0.35.0
func NewDeltaAppender(appender pyroscope.Appender, labels labels.Labels) pyroscope.Appender
Types ¶
type Arguments ¶
type Arguments struct {
Targets []discovery.Target `river:"targets,attr"`
ForwardTo []pyroscope.Appendable `river:"forward_to,attr"`
// The job name to override the job label with.
JobName string `river:"job_name,attr,optional"`
// A set of query parameters with which the target is scraped.
Params url.Values `river:"params,attr,optional"`
// How frequently to scrape the targets of this scrape config.
ScrapeInterval time.Duration `river:"scrape_interval,attr,optional"`
// The timeout for scraping targets of this config.
ScrapeTimeout time.Duration `river:"scrape_timeout,attr,optional"`
// The URL scheme with which to fetch metrics from targets.
Scheme string `river:"scheme,attr,optional"`
HTTPClientConfig component_config.HTTPClientConfig `river:",squash"`
ProfilingConfig ProfilingConfig `river:"profiling_config,block,optional"`
Clustering cluster.ComponentBlock `river:"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 ¶ added in v0.35.0
func (arg *Arguments) SetToDefault()
SetToDefault implements river.Defaulter.
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 ¶ added in v0.36.0
func (c *Component) NotifyClusterChange()
NotifyClusterChange implements component.ClusterComponent.
type CustomProfilingTarget ¶
type CustomProfilingTarget struct {
Enabled bool `river:"enabled,attr"`
Path string `river:"path,attr"`
Delta bool `river:"delta,attr,optional"`
Name string `river:",label"`
}
type DeltaProfiler ¶ added in v0.35.0
type DeltaProfiler interface {
Delta(p []byte, out io.Writer) error
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(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) 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 ProfilingConfig ¶
type ProfilingConfig struct {
Memory ProfilingTarget `river:"profile.memory,block,optional"`
Block ProfilingTarget `river:"profile.block,block,optional"`
Goroutine ProfilingTarget `river:"profile.goroutine,block,optional"`
Mutex ProfilingTarget `river:"profile.mutex,block,optional"`
ProcessCPU ProfilingTarget `river:"profile.process_cpu,block,optional"`
FGProf ProfilingTarget `river:"profile.fgprof,block,optional"`
GoDeltaProfMemory ProfilingTarget `river:"profile.godeltaprof_memory,block,optional"`
GoDeltaProfMutex ProfilingTarget `river:"profile.godeltaprof_mutex,block,optional"`
GoDeltaProfBlock ProfilingTarget `river:"profile.godeltaprof_block,block,optional"`
Custom []CustomProfilingTarget `river:"profile.custom,block,optional"`
PprofPrefix string `river:"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 ¶ added in v0.35.0
func (cfg *ProfilingConfig) SetToDefault()
SetToDefault implements river.Defaulter.
type ProfilingTarget ¶
type ProfilingTarget struct {
Enabled bool `river:"enabled,attr,optional"`
Path string `river:"path,attr,optional"`
Delta bool `river:"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) DiscoveredLabels ¶
func (t *Target) DiscoveredLabels() labels.Labels
DiscoveredLabels returns a copy of the target's labels before any processing.
func (*Target) Hash ¶ added in v0.38.0
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.
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.