From 18d38af46267f7fd8f7c140c6695fe62e3da7f69 Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Wed, 24 Jul 2024 01:23:54 +0530 Subject: [PATCH] fix: add comments --- metricbeat/module/system/process/process.go | 1 + metricbeat/module/system/process_summary/process_summary.go | 1 + 2 files changed, 2 insertions(+) diff --git a/metricbeat/module/system/process/process.go b/metricbeat/module/system/process/process.go index cebe224916e2..684c87059c91 100644 --- a/metricbeat/module/system/process/process.go +++ b/metricbeat/module/system/process/process.go @@ -113,6 +113,7 @@ func (m *MetricSet) Fetch(r mb.ReporterV2) error { if m.setpid == 0 { procs, roots, err := m.stats.Get() if err != nil && !errors.Is(err, process.NonFatalErr{}) { + // return only if the error is fatal in nature return fmt.Errorf("process stats: %w", err) } diff --git a/metricbeat/module/system/process_summary/process_summary.go b/metricbeat/module/system/process_summary/process_summary.go index 9bf78f0bf45f..cbf1c63a2fe5 100644 --- a/metricbeat/module/system/process_summary/process_summary.go +++ b/metricbeat/module/system/process_summary/process_summary.go @@ -71,6 +71,7 @@ func (m *MetricSet) Fetch(r mb.ReporterV2) error { procList, degradeErr := process.ListStates(m.sys) if degradeErr != nil && !errors.Is(degradeErr, process.NonFatalErr{}) { + // return only if the error is fatal in nature return fmt.Errorf("error fetching process list: %w", degradeErr) }