From 908553d797cc2541f8d7f61c333658705e324e33 Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Thu, 18 Jul 2024 19:04:52 +0530 Subject: [PATCH] chore: rename function --- metricbeat/module/system/process/process.go | 2 +- metricbeat/module/system/process/process_test.go | 4 ++-- metricbeat/module/system/process_summary/process_summary.go | 2 +- .../module/system/process_summary/process_summary_test.go | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/metricbeat/module/system/process/process.go b/metricbeat/module/system/process/process.go index dfc7e5752a7..774745b2b34 100644 --- a/metricbeat/module/system/process/process.go +++ b/metricbeat/module/system/process/process.go @@ -111,7 +111,7 @@ func (m *MetricSet) Fetch(r mb.ReporterV2) error { // monitor either a single PID, or the configured set of processes. if m.setpid == 0 { procs, roots, err := m.stats.Get() - if err != nil && !process.IsDegradable(err) { + if err != nil && !process.CanDegrade(err) { return fmt.Errorf("process stats: %w", err) } diff --git a/metricbeat/module/system/process/process_test.go b/metricbeat/module/system/process/process_test.go index 60a13040254..737b8d615f6 100644 --- a/metricbeat/module/system/process/process_test.go +++ b/metricbeat/module/system/process/process_test.go @@ -38,7 +38,7 @@ func TestFetch(t *testing.T) { f := mbtest.NewReportingMetricSetV2Error(t, getConfig()) events, errs := mbtest.ReportingFetchV2Error(f) for _, err := range errs { - assert.True(t, process.IsDegradable(err)) + assert.True(t, process.CanDegrade(err)) } assert.NotEmpty(t, events) @@ -46,7 +46,7 @@ func TestFetch(t *testing.T) { events, errs = mbtest.ReportingFetchV2Error(f) for _, err := range errs { - assert.True(t, process.IsDegradable(err)) + assert.True(t, process.CanDegrade(err)) } assert.NotEmpty(t, events) diff --git a/metricbeat/module/system/process_summary/process_summary.go b/metricbeat/module/system/process_summary/process_summary.go index 2f30319203c..7fde92e8a9c 100644 --- a/metricbeat/module/system/process_summary/process_summary.go +++ b/metricbeat/module/system/process_summary/process_summary.go @@ -69,7 +69,7 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { func (m *MetricSet) Fetch(r mb.ReporterV2) error { procList, degradeErr := process.ListStates(m.sys) - if degradeErr != nil && !process.IsDegradable(degradeErr) { + if degradeErr != nil && !process.CanDegrade(degradeErr) { return fmt.Errorf("error fetching process list: %w", degradeErr) } diff --git a/metricbeat/module/system/process_summary/process_summary_test.go b/metricbeat/module/system/process_summary/process_summary_test.go index 254ea10548d..a0083c03dc6 100644 --- a/metricbeat/module/system/process_summary/process_summary_test.go +++ b/metricbeat/module/system/process_summary/process_summary_test.go @@ -47,7 +47,7 @@ func TestFetch(t *testing.T) { events, errs := mbtest.ReportingFetchV2Error(f) for _, err := range errs { - assert.True(t, process.IsDegradable(err)) + assert.True(t, process.CanDegrade(err)) } require.NotEmpty(t, events) event := events[0].BeatEvent("system", "process_summary").Fields @@ -65,7 +65,7 @@ func TestStateNames(t *testing.T) { events, errs := mbtest.ReportingFetchV2Error(f) for _, err := range errs { - assert.True(t, process.IsDegradable(err)) + assert.True(t, process.CanDegrade(err)) } require.NotEmpty(t, events) event := events[0].BeatEvent("system", "process_summary").Fields