Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow up addressing comments in #4127 #4173

Merged
merged 1 commit into from
May 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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