Documentation ¶
Index ¶
- func StartCollector(collector Collector) io.Closer
- func StartCollectorWith(config Config) io.Closer
- type CPUInfo
- type Collector
- type CollectorFunc
- type Config
- type DelayInfo
- type DelayMetrics
- type FileInfo
- type GoMetrics
- type MemoryInfo
- type OSUnsupportedError
- type ProcInfo
- type ProcMetrics
- type ThreadInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartCollector ¶
StartCollector starts a Collector with a default Config.
func StartCollectorWith ¶
StartCollectorWith starts a Collector with the provided Config.
Types ¶
type CPUInfo ¶
type CPUInfo struct { User time.Duration // user cpu time used by the process Sys time.Duration // system cpu time used by the process // Linux-specific details about the CPU configuration of the process. // // The values are all zero if they are not known. // // For more details on what those values represent see: // https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt // https://kernel.googlesource.com/pub/scm/linux/kernel/git/glommer/memcg/+/cpu_stat/Documentation/cgroups/cpu.txt Period time.Duration // scheduler period Quota time.Duration // time quota in the scheduler period }
CPUInfo holds statistics and configuration details for a process.
type Collector ¶
type Collector interface {
Collect()
}
Collector is an interface that wraps the Collect() method.
func MultiCollector ¶
MultiCollector coalesces a variadic number of Collectors and returns a single Collector.
type CollectorFunc ¶
type CollectorFunc func()
CollectorFunc is a type alias for func().
func (CollectorFunc) Collect ¶
func (f CollectorFunc) Collect()
Collect calls the underling CollectorFunc func().
type DelayInfo ¶
type DelayInfo struct { CPUDelay time.Duration BlockIODelay time.Duration SwapInDelay time.Duration FreePagesDelay time.Duration }
DelayInfo stores delay Durations for various resources.
func CollectDelayInfo ¶
CollectDelayInfo returns DelayInfo for a pid and an error, if any.
type DelayMetrics ¶
type DelayMetrics struct { CPUDelay time.Duration `metric:"cpu.delay.seconds" type:"counter"` BlockIODelay time.Duration `metric:"blockio.delay.seconds" type:"counter"` SwapInDelay time.Duration `metric:"swapin.delay.seconds" type:"counter"` FreePagesDelay time.Duration `metric:"freepages.delay.seconds" type:"counter"` // contains filtered or unexported fields }
DelayMetrics is a metric collector that reports resource delays on processes.
func NewDelayMetrics ¶
func NewDelayMetrics() *DelayMetrics
NewDelayMetrics collects metrics on the current process and reports them to the default stats engine.
func NewDelayMetricsWith ¶
func NewDelayMetricsWith(eng *stats.Engine, pid int) *DelayMetrics
NewDelayMetricsWith collects metrics on the process identified by pid and reports them to eng.
func (*DelayMetrics) Collect ¶
func (d *DelayMetrics) Collect()
Collect satisfies the Collector interface.
type FileInfo ¶
type FileInfo struct { Open uint64 // fds opened by the process Max uint64 // max number of fds the process can open }
FileInfo holds statistics about open and max file handles for a process.
type GoMetrics ¶
type GoMetrics struct {
// contains filtered or unexported fields
}
GoMetrics is a metric collector that reports metrics from the Go runtime.
func NewGoMetrics ¶
func NewGoMetrics() *GoMetrics
NewGoMetrics creates a new collector for the Go runtime that produces metrics on the default stats engine.
func NewGoMetricsWith ¶
func NewGoMetricsWith(eng *stats.Engine) *GoMetrics
NewGoMetricsWith creates a new collector for the Go unrtime that producers metrics on eng.
type MemoryInfo ¶
type MemoryInfo struct { Available uint64 // amount of RAM available to the process Size uint64 // total program memory (including virtual mappings) Resident uint64 // resident set size Text uint64 // text (code) Data uint64 // data + stack MajorPageFaults uint64 MinorPageFaults uint64 }
MemoryInfo holds statistics and configuration about Memory usage for a process.
type OSUnsupportedError ¶ added in v4.7.4
type OSUnsupportedError struct {
Msg string
}
func (*OSUnsupportedError) Error ¶ added in v4.7.4
func (o *OSUnsupportedError) Error() string
type ProcInfo ¶
type ProcInfo struct { CPU CPUInfo Memory MemoryInfo Files FileInfo Threads ThreadInfo }
ProcInfo contains types which hold statistics for various resources.
func CollectProcInfo ¶
CollectProcInfo returns a ProcInfo and error (if any) for a given PID.
type ProcMetrics ¶
type ProcMetrics struct {
// contains filtered or unexported fields
}
ProcMetrics is a metric collector that reports metrics on processes.
func NewProcMetrics ¶
func NewProcMetrics() *ProcMetrics
NewProcMetrics collects metrics on the current process and reports them to the default stats engine.
func NewProcMetricsWith ¶
func NewProcMetricsWith(eng *stats.Engine, pid int) *ProcMetrics
NewProcMetricsWith collects metrics on the process identified by pid and reports them to eng.
func (*ProcMetrics) Collect ¶
func (p *ProcMetrics) Collect()
Collect satisfies the Collector interface.
type ThreadInfo ¶
type ThreadInfo struct { Num uint64 VoluntaryContextSwitches uint64 InvoluntaryContextSwitches uint64 }
ThreadInfo holds statistics about number of threads and context switches for a process.