Update metric dependencies (#5023)
This commit is contained in:
parent
4befa8cc8a
commit
9278f0cad2
128 changed files with 3873 additions and 2729 deletions
4
vendor/github.com/ncabatoff/process-exporter/proc/grouper.go
generated
vendored
4
vendor/github.com/ncabatoff/process-exporter/proc/grouper.go
generated
vendored
|
|
@ -49,11 +49,11 @@ type (
|
|||
func lessThreads(x, y Threads) bool { return seq.Compare(x, y) < 0 }
|
||||
|
||||
// NewGrouper creates a grouper.
|
||||
func NewGrouper(namer common.MatchNamer, trackChildren, alwaysRecheck, debug bool) *Grouper {
|
||||
func NewGrouper(namer common.MatchNamer, trackChildren, trackThreads, alwaysRecheck, debug bool) *Grouper {
|
||||
g := Grouper{
|
||||
groupAccum: make(map[string]Counts),
|
||||
threadAccum: make(map[string]map[string]Threads),
|
||||
tracker: NewTracker(namer, trackChildren, alwaysRecheck, debug),
|
||||
tracker: NewTracker(namer, trackChildren, trackThreads, alwaysRecheck, debug),
|
||||
debug: debug,
|
||||
}
|
||||
return &g
|
||||
|
|
|
|||
10
vendor/github.com/ncabatoff/process-exporter/proc/read.go
generated
vendored
10
vendor/github.com/ncabatoff/process-exporter/proc/read.go
generated
vendored
|
|
@ -379,7 +379,7 @@ func (p proc) GetCounts() (Counts, int, error) {
|
|||
if err == os.ErrNotExist {
|
||||
err = ErrProcNotExist
|
||||
}
|
||||
return Counts{}, 0, err
|
||||
return Counts{}, 0, fmt.Errorf("error reading stat file: %v", err)
|
||||
}
|
||||
|
||||
status, err := p.getStatus()
|
||||
|
|
@ -387,7 +387,7 @@ func (p proc) GetCounts() (Counts, int, error) {
|
|||
if err == os.ErrNotExist {
|
||||
err = ErrProcNotExist
|
||||
}
|
||||
return Counts{}, 0, err
|
||||
return Counts{}, 0, fmt.Errorf("error reading status file: %v", err)
|
||||
}
|
||||
|
||||
io, err := p.getIo()
|
||||
|
|
@ -450,10 +450,8 @@ func (p proc) GetMetrics() (Metrics, int, error) {
|
|||
// Ditto for states
|
||||
states, _ := p.GetStates()
|
||||
|
||||
status, err := p.getStatus()
|
||||
if err != nil {
|
||||
return Metrics{}, 0, err
|
||||
}
|
||||
// Ditto for status
|
||||
status, _ := p.getStatus()
|
||||
|
||||
numfds, err := p.Proc.FileDescriptorsLen()
|
||||
if err != nil {
|
||||
|
|
|
|||
22
vendor/github.com/ncabatoff/process-exporter/proc/tracker.go
generated
vendored
22
vendor/github.com/ncabatoff/process-exporter/proc/tracker.go
generated
vendored
|
|
@ -26,6 +26,8 @@ type (
|
|||
// trackChildren makes Tracker track descendants of procs the
|
||||
// namer wanted tracked.
|
||||
trackChildren bool
|
||||
// trackThreads makes Tracker track per-thread metrics.
|
||||
trackThreads bool
|
||||
// never ignore processes, i.e. always re-check untracked processes in case comm has changed
|
||||
alwaysRecheck bool
|
||||
username map[int]string
|
||||
|
|
@ -85,7 +87,8 @@ type (
|
|||
States
|
||||
// Wchans is how many threads are in each non-zero wchan.
|
||||
Wchans map[string]int
|
||||
// Threads are the thread updates for this process.
|
||||
// Threads are the thread updates for this process, if the Tracker
|
||||
// has trackThreads==true.
|
||||
Threads []ThreadUpdate
|
||||
}
|
||||
|
||||
|
|
@ -135,12 +138,13 @@ func (tp *trackedProc) getUpdate() Update {
|
|||
}
|
||||
|
||||
// NewTracker creates a Tracker.
|
||||
func NewTracker(namer common.MatchNamer, trackChildren, alwaysRecheck, debug bool) *Tracker {
|
||||
func NewTracker(namer common.MatchNamer, trackChildren, trackThreads, alwaysRecheck, debug bool) *Tracker {
|
||||
return &Tracker{
|
||||
namer: namer,
|
||||
tracked: make(map[ID]*trackedProc),
|
||||
procIds: make(map[int]ID),
|
||||
trackChildren: trackChildren,
|
||||
trackThreads: trackThreads,
|
||||
alwaysRecheck: alwaysRecheck,
|
||||
username: make(map[int]string),
|
||||
debug: debug,
|
||||
|
|
@ -206,6 +210,9 @@ func (t *Tracker) handleProc(proc Proc, updateTime time.Time) (*IDInfo, CollectE
|
|||
var cerrs CollectErrors
|
||||
procID, err := proc.GetProcID()
|
||||
if err != nil {
|
||||
if t.debug {
|
||||
log.Printf("error getting proc ID for pid %+v: %v", proc.GetPid(), err)
|
||||
}
|
||||
return nil, cerrs
|
||||
}
|
||||
|
||||
|
|
@ -231,6 +238,9 @@ func (t *Tracker) handleProc(proc Proc, updateTime time.Time) (*IDInfo, CollectE
|
|||
var threads []Thread
|
||||
threads, err = proc.GetThreads()
|
||||
if err != nil {
|
||||
if t.debug {
|
||||
log.Printf("can't read thread metrics for %+v: %v", procID, err)
|
||||
}
|
||||
softerrors |= 1
|
||||
}
|
||||
cerrs.Partial += softerrors
|
||||
|
|
@ -396,9 +406,11 @@ func (t *Tracker) Update(iter Iter) (CollectErrors, []Update, error) {
|
|||
untracked := make(map[ID]IDInfo)
|
||||
for _, idinfo := range newProcs {
|
||||
nacl := common.ProcAttributes{
|
||||
Name: idinfo.Name,
|
||||
Cmdline: idinfo.Cmdline,
|
||||
Username: t.lookupUid(idinfo.EffectiveUID),
|
||||
Name: idinfo.Name,
|
||||
Cmdline: idinfo.Cmdline,
|
||||
Username: t.lookupUid(idinfo.EffectiveUID),
|
||||
PID: idinfo.Pid,
|
||||
StartTime: idinfo.StartTime,
|
||||
}
|
||||
wanted, gname := t.namer.MatchAndName(nacl)
|
||||
if wanted {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue