Skip to content

Commit a1fd2c9

Browse files
authored
[pkg][fix] - Filter non-fatal errors and update go.mod (#5196)
* fix: update go.mod and test cases * chore: update notice * fix: go.mod * fix: update notice * fix: update notice, go.mod * fix: update notice, go.mod * fix: fix check * fix: update notice, go.mod to v0.11.0
1 parent 30e1b9b commit a1fd2c9

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

NOTICE.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1475,11 +1475,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-l
14751475

14761476
--------------------------------------------------------------------------------
14771477
Dependency : github.com/elastic/elastic-agent-system-metrics
1478-
Version: v0.10.8
1478+
Version: v0.11.0
14791479
Licence type (autodetected): Apache-2.0
14801480
--------------------------------------------------------------------------------
14811481

1482-
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-system-metrics@v0.10.8/LICENSE.txt:
1482+
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-system-metrics@v0.11.0/LICENSE.txt:
14831483

14841484
Apache License
14851485
Version 2.0, January 2004

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ require (
1515
github.com/elastic/elastic-agent-autodiscover v0.8.1
1616
github.com/elastic/elastic-agent-client/v7 v7.15.0
1717
github.com/elastic/elastic-agent-libs v0.9.15
18-
github.com/elastic/elastic-agent-system-metrics v0.10.8
18+
github.com/elastic/elastic-agent-system-metrics v0.11.0
1919
github.com/elastic/elastic-transport-go/v8 v8.6.0
2020
github.com/elastic/go-elasticsearch/v8 v8.14.0
2121
github.com/elastic/go-licenser v0.4.2

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -782,8 +782,8 @@ github.com/elastic/elastic-agent-client/v7 v7.15.0 h1:nDB7v8TBoNuD6IIzC3z7Q0y+7b
782782
github.com/elastic/elastic-agent-client/v7 v7.15.0/go.mod h1:6h+f9QdIr3GO2ODC0Y8+aEXRwzbA5W4eV4dd/67z7nI=
783783
github.com/elastic/elastic-agent-libs v0.9.15 h1:WCLtuErafUxczT/rXJa4Vr6mxwC8dgtqMbEq+qWGD4M=
784784
github.com/elastic/elastic-agent-libs v0.9.15/go.mod h1:2VgYxHaeM+cCDBjiS2wbmTvzPGbnlXAtYrlcLefheS8=
785-
github.com/elastic/elastic-agent-system-metrics v0.10.8 h1:YoX3GfWWDtL5YrBkIbl7jQ/usOxBi+0N9jHke2EzFCk=
786-
github.com/elastic/elastic-agent-system-metrics v0.10.8/go.mod h1:3QiMu9wTKJFvpCN+5klgGqasTMNKJbgY3xcoN1KQXJk=
785+
github.com/elastic/elastic-agent-system-metrics v0.11.0 h1:/bWrgTsHZWLUhdT7WPNuQDFkrSfm+A4qf6QDQnZo9d8=
786+
github.com/elastic/elastic-agent-system-metrics v0.11.0/go.mod h1:3QiMu9wTKJFvpCN+5klgGqasTMNKJbgY3xcoN1KQXJk=
787787
github.com/elastic/elastic-transport-go/v8 v8.6.0 h1:Y2S/FBjx1LlCv5m6pWAF2kDJAHoSjSRSJCApolgfthA=
788788
github.com/elastic/elastic-transport-go/v8 v8.6.0/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk=
789789
github.com/elastic/go-docappender/v2 v2.2.1 h1:SxtmDwTPu4Smu8oggEojE/6QafNL1HJAwLDu7U7hZPA=

pkg/testing/fixture_install.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ func getProcesses(t *gotesting.T, regex string) []runningProcess {
379379
}
380380

381381
_, pids, err := procStats.FetchPids()
382-
if !assert.NoError(t, err, "error fetching process information") {
382+
if err != nil && assert.Truef(t, errors.Is(err, agentsystemprocess.NonFatalErr{}), "error fetching process information: %v", err) {
383383
// we failed a bit further
384384
return nil
385385
}

pkg/utils/watcher.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package utils
66

77
import (
8+
"errors"
89
"fmt"
910
"path/filepath"
1011
"strings"
@@ -24,7 +25,8 @@ func GetWatcherPIDs() ([]int, error) {
2425
return nil, fmt.Errorf("failed to initialize process.Stats: %w", err)
2526
}
2627
pidMap, _, err := procStats.FetchPids()
27-
if err != nil {
28+
if err != nil && !errors.Is(err, process.NonFatalErr{}) {
29+
// return only if the error is fatal in nature
2830
return nil, fmt.Errorf("failed to fetch pids: %w", err)
2931
}
3032
var pids []int

0 commit comments

Comments
 (0)