Skip to content

Commit

Permalink
chore: rename function
Browse files Browse the repository at this point in the history
  • Loading branch information
VihasMakwana committed Jul 18, 2024
1 parent 51a7854 commit 908553d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion metricbeat/module/system/process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
4 changes: 2 additions & 2 deletions metricbeat/module/system/process/process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ 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)

time.Sleep(2 * time.Second)

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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 908553d

Please sign in to comment.