Skip to content

Commit

Permalink
Remove process.GetProcStatsEvents as not needed anymore (#3066)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruflin authored and andrewkroh committed Nov 28, 2016
1 parent ea899d3 commit 7ca7848
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 28 deletions.
30 changes: 4 additions & 26 deletions metricbeat/module/system/process/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ type Process struct {
}

type ProcStats struct {
ProcStats bool
Procs []string
regexps []*regexp.Regexp
ProcsMap ProcsMap
CpuTicks bool
Procs []string
regexps []*regexp.Regexp
ProcsMap ProcsMap
CpuTicks bool
}

// newProcess creates a new Process object based on the state information.
Expand Down Expand Up @@ -124,7 +123,6 @@ func getProcFDUsage(pid int) (*sigar.ProcFDUsage, error) {
func GetProcMemPercentage(proc *Process, totalPhyMem uint64) float64 {

// in unit tests, total_phymem is set to a value greater than zero

if totalPhyMem == 0 {
memStat, err := memory.GetMemory()
if err != nil {
Expand Down Expand Up @@ -310,26 +308,6 @@ func (procStats *ProcStats) GetProcStats() ([]common.MapStr, error) {
return processes, nil
}

func (procStats *ProcStats) GetProcStatsEvents() ([]common.MapStr, error) {
processes, err := procStats.GetProcStats()
if err != nil {
return nil, err
}

events := make([]common.MapStr, len(processes))
for _, proc := range processes {
event := common.MapStr{
"@timestamp": common.Time(time.Now()),
"type": "process",
"proc": proc,
}

events = append(events, event)
}

return events, nil
}

// unixTimeMsToTime converts a unix time given in milliseconds since Unix epoch
// to a common.Time value.
func unixTimeMsToTime(unixTimeMs uint64) common.Time {
Expand Down
3 changes: 1 addition & 2 deletions metricbeat/module/system/process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
m := &MetricSet{
BaseMetricSet: base,
stats: &ProcStats{
ProcStats: true,
Procs: config.Procs,
Procs: config.Procs,
},
}
err := m.stats.InitProcStats()
Expand Down

0 comments on commit 7ca7848

Please sign in to comment.