Add user tag to procstat input (#4386)
This commit is contained in:
@@ -21,6 +21,7 @@ type Process interface {
|
||||
Percent(interval time.Duration) (float64, error)
|
||||
Times() (*cpu.TimesStat, error)
|
||||
RlimitUsage(bool) ([]process.RlimitStat, error)
|
||||
Username() (string, error)
|
||||
}
|
||||
|
||||
type PIDFinder interface {
|
||||
@@ -58,6 +59,10 @@ func (p *Proc) PID() PID {
|
||||
return PID(p.Process.Pid)
|
||||
}
|
||||
|
||||
func (p *Proc) Username() (string, error) {
|
||||
return p.Process.Username()
|
||||
}
|
||||
|
||||
func (p *Proc) Percent(interval time.Duration) (float64, error) {
|
||||
cpu_perc, err := p.Process.Percent(time.Duration(0))
|
||||
if !p.hasCPUTimes && err == nil {
|
||||
|
||||
Reference in New Issue
Block a user