Skip to content

Commit

Permalink
Follow up addressing comments in elastic#4127
Browse files Browse the repository at this point in the history
Follow up for elastic#4127 to address comments.
  • Loading branch information
Tudor Golubenco committed May 2, 2017
1 parent 4660a9b commit 3d690d6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion metricbeat/docs/modules/system.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ metricbeat.modules:
*`process.include_top_n`*:: These options allow you to filter out all processes
that are not in the top N by CPU or memory, in order to reduce the number of
documents created. If both the `by_cpu` and `by_memory` options are used, the
reunion of the two tops is included.
union of the two sets is included.

*`process.include_top_n.enabled`*:: Set to false to disable the top N feature and
include all processes, regardless of the other options. The default is `true`,
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/metricbeat.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ metricbeat.modules:

# These options allow you to filter out all processes that are not
# in the top N by CPU or memory, in order to reduce the number of documents created.
# If both the `by_cpu` and `by_memory` options are used, the reunion of the two tops
# If both the `by_cpu` and `by_memory` options are used, the union of the two sets
# is included.
#process.include_top_n:
#
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/system/_meta/config.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

# These options allow you to filter out all processes that are not
# in the top N by CPU or memory, in order to reduce the number of documents created.
# If both the `by_cpu` and `by_memory` options are used, the reunion of the two tops
# If both the `by_cpu` and `by_memory` options are used, the union of the two sets
# is included.
#process.include_top_n:
#
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/system/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ metricbeat.modules:
*`process.include_top_n`*:: These options allow you to filter out all processes
that are not in the top N by CPU or memory, in order to reduce the number of
documents created. If both the `by_cpu` and `by_memory` options are used, the
reunion of the two tops is included.
union of the two sets is included.

*`process.include_top_n.enabled`*:: Set to false to disable the top N feature and
include all processes, regardless of the other options. The default is `true`,
Expand Down
6 changes: 3 additions & 3 deletions metricbeat/module/system/process/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ func (procStats *ProcStats) GetProcStats() ([]common.MapStr, error) {
return nil, err
}

processes := []Process{}
var processes []Process
newProcs := make(ProcsMap, len(pids))

for _, pid := range pids {
Expand Down Expand Up @@ -376,7 +376,7 @@ func (procStats *ProcStats) GetProcStats() ([]common.MapStr, error) {
processes = procStats.includeTopProcesses(processes)
logp.Debug("processes", "Filtered top processes down to %d processes", len(processes))

procs := []common.MapStr{}
procs := make([]common.MapStr, 0, len(processes))
for _, process := range processes {
proc := procStats.getProcessEvent(&process)
procs = append(procs, proc)
Expand All @@ -393,7 +393,7 @@ func (procStats *ProcStats) includeTopProcesses(processes []Process) []Process {
return processes
}

result := []Process{}
var result []Process
if procStats.IncludeTop.ByCPU > 0 {
sort.Slice(processes, func(i, j int) bool {
return processes[i].cpuTotalPct > processes[j].cpuTotalPct
Expand Down

0 comments on commit 3d690d6

Please sign in to comment.