Skip to content

Commit

Permalink
[pkg][fix] - Filter non-fatal errors and update go.mod (#5196)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
VihasMakwana authored Aug 6, 2024
1 parent 30e1b9b commit a1fd2c9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1475,11 +1475,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-l

--------------------------------------------------------------------------------
Dependency : github.com/elastic/elastic-agent-system-metrics
Version: v0.10.8
Version: v0.11.0
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

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

Apache License
Version 2.0, January 2004
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/elastic/elastic-agent-autodiscover v0.8.1
github.com/elastic/elastic-agent-client/v7 v7.15.0
github.com/elastic/elastic-agent-libs v0.9.15
github.com/elastic/elastic-agent-system-metrics v0.10.8
github.com/elastic/elastic-agent-system-metrics v0.11.0
github.com/elastic/elastic-transport-go/v8 v8.6.0
github.com/elastic/go-elasticsearch/v8 v8.14.0
github.com/elastic/go-licenser v0.4.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -782,8 +782,8 @@ github.com/elastic/elastic-agent-client/v7 v7.15.0 h1:nDB7v8TBoNuD6IIzC3z7Q0y+7b
github.com/elastic/elastic-agent-client/v7 v7.15.0/go.mod h1:6h+f9QdIr3GO2ODC0Y8+aEXRwzbA5W4eV4dd/67z7nI=
github.com/elastic/elastic-agent-libs v0.9.15 h1:WCLtuErafUxczT/rXJa4Vr6mxwC8dgtqMbEq+qWGD4M=
github.com/elastic/elastic-agent-libs v0.9.15/go.mod h1:2VgYxHaeM+cCDBjiS2wbmTvzPGbnlXAtYrlcLefheS8=
github.com/elastic/elastic-agent-system-metrics v0.10.8 h1:YoX3GfWWDtL5YrBkIbl7jQ/usOxBi+0N9jHke2EzFCk=
github.com/elastic/elastic-agent-system-metrics v0.10.8/go.mod h1:3QiMu9wTKJFvpCN+5klgGqasTMNKJbgY3xcoN1KQXJk=
github.com/elastic/elastic-agent-system-metrics v0.11.0 h1:/bWrgTsHZWLUhdT7WPNuQDFkrSfm+A4qf6QDQnZo9d8=
github.com/elastic/elastic-agent-system-metrics v0.11.0/go.mod h1:3QiMu9wTKJFvpCN+5klgGqasTMNKJbgY3xcoN1KQXJk=
github.com/elastic/elastic-transport-go/v8 v8.6.0 h1:Y2S/FBjx1LlCv5m6pWAF2kDJAHoSjSRSJCApolgfthA=
github.com/elastic/elastic-transport-go/v8 v8.6.0/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk=
github.com/elastic/go-docappender/v2 v2.2.1 h1:SxtmDwTPu4Smu8oggEojE/6QafNL1HJAwLDu7U7hZPA=
Expand Down
2 changes: 1 addition & 1 deletion pkg/testing/fixture_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ func getProcesses(t *gotesting.T, regex string) []runningProcess {
}

_, pids, err := procStats.FetchPids()
if !assert.NoError(t, err, "error fetching process information") {
if err != nil && assert.Truef(t, errors.Is(err, agentsystemprocess.NonFatalErr{}), "error fetching process information: %v", err) {
// we failed a bit further
return nil
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/utils/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package utils

import (
"errors"
"fmt"
"path/filepath"
"strings"
Expand All @@ -24,7 +25,8 @@ func GetWatcherPIDs() ([]int, error) {
return nil, fmt.Errorf("failed to initialize process.Stats: %w", err)
}
pidMap, _, err := procStats.FetchPids()
if err != nil {
if err != nil && !errors.Is(err, process.NonFatalErr{}) {
// return only if the error is fatal in nature
return nil, fmt.Errorf("failed to fetch pids: %w", err)
}
var pids []int
Expand Down

0 comments on commit a1fd2c9

Please sign in to comment.