File tree Expand file tree Collapse file tree
metricbeat/module/system/process Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020package process
2121
2222import (
23+ "errors"
2324 "fmt"
2425 "os"
2526 "runtime"
@@ -30,9 +31,11 @@ import (
3031 "github.com/elastic/elastic-agent-system-metrics/metric/system/cgroup"
3132 "github.com/elastic/elastic-agent-system-metrics/metric/system/process"
3233 "github.com/elastic/elastic-agent-system-metrics/metric/system/resolve"
34+ "github.com/joeshaw/multierror"
3335)
3436
3537var debugf = logp .NewLogger ("system.process" ).Debugf
38+ var typeMultiError * multierror.MultiError
3639
3740func init () {
3841 mb .Registry .MustAddMetricSet ("system" , "process" , New ,
@@ -111,7 +114,7 @@ func (m *MetricSet) Fetch(r mb.ReporterV2) error {
111114 // monitor either a single PID, or the configured set of processes.
112115 if m .setpid == 0 {
113116 procs , roots , err := m .stats .Get ()
114- if err != nil {
117+ if errors . As ( err , & typeMultiError ) && err != nil {
115118 return fmt .Errorf ("process stats: %w" , err )
116119 }
117120
@@ -124,6 +127,7 @@ func (m *MetricSet) Fetch(r mb.ReporterV2) error {
124127 return nil
125128 }
126129 }
130+ return err
127131 } else {
128132 proc , root , err := m .stats .GetOneRootEvent (m .setpid )
129133 if err != nil {
@@ -133,7 +137,6 @@ func (m *MetricSet) Fetch(r mb.ReporterV2) error {
133137 MetricSetFields : proc ,
134138 RootFields : root ,
135139 })
140+ return err
136141 }
137-
138- return nil
139142}
You can’t perform that action at this time.
0 commit comments