Skip to content

Commit ab27a75

Browse files
committed
Update file watcher to only monitor directories referenced in the nginx configuration
1 parent 37283f0 commit ab27a75

File tree

5 files changed

+5
-32
lines changed

5 files changed

+5
-32
lines changed

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ require (
1616
github.com/google/uuid v1.6.0
1717
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
1818
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.1
19-
github.com/hashicorp/go-multierror v1.1.1
2019
github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c
2120
github.com/nginxinc/nginx-plus-go-client/v2 v2.0.1
2221
github.com/nginxinc/nginx-prometheus-exporter v1.3.0
@@ -133,7 +132,6 @@ require (
133132
github.com/gorilla/mux v1.8.1 // indirect
134133
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
135134
github.com/hashicorp/consul/api v1.30.0 // indirect
136-
github.com/hashicorp/errwrap v1.1.0 // indirect
137135
github.com/hashicorp/go-version v1.7.0 // indirect
138136
github.com/hashicorp/golang-lru v1.0.2 // indirect
139137
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect

go.sum

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ github.com/hashicorp/consul/api v1.30.0 h1:ArHVMMILb1nQv8vZSGIwwQd2gtc+oSQZ6Caly
278278
github.com/hashicorp/consul/api v1.30.0/go.mod h1:B2uGchvaXVW2JhFoS8nqTxMD5PBykr4ebY4JWHTTeLM=
279279
github.com/hashicorp/cronexpr v1.1.2 h1:wG/ZYIKT+RT3QkOdgYc+xsKWVRgnxJ1OJtjjy84fJ9A=
280280
github.com/hashicorp/cronexpr v1.1.2/go.mod h1:P4wA0KBl9C5q2hABiMO7cp6jcIg96CDh1Efb3g1PWA4=
281-
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
282281
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
283282
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
284283
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=

internal/collector/containermetricsreceiver/internal/scraper/cpuscraper/internal/cgroup/cpu_test.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@
66
package cgroup
77

88
import (
9-
"errors"
109
"os"
1110
"path"
1211
"runtime"
1312
"strconv"
1413
"testing"
1514

16-
"github.com/hashicorp/go-multierror"
17-
1815
"github.com/stretchr/testify/assert"
1916
)
2017

@@ -79,16 +76,7 @@ func TestCollectCPUStats(t *testing.T) {
7976
cpuStat, err := cgroupCPUSource.collectCPUStats()
8077

8178
// Assert error
82-
if err != nil {
83-
var multiError *multierror.Error
84-
if errors.As(err, &multiError) {
85-
assert.IsType(tt, test.errorType, multiError.Errors[0])
86-
} else {
87-
assert.IsType(tt, test.errorType, err)
88-
}
89-
} else {
90-
assert.IsType(tt, test.errorType, err)
91-
}
79+
assert.IsType(tt, test.errorType, err)
9280

9381
// Assert result
9482
assert.Equal(tt, test.cpuStat, cpuStat)

internal/collector/containermetricsreceiver/internal/scraper/memoryscraper/internal/cgroup/memory_test.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,12 @@ package cgroup
77

88
import (
99
"context"
10-
"errors"
1110
"os"
1211
"path"
1312
"runtime"
1413
"strconv"
1514
"testing"
1615

17-
"github.com/hashicorp/go-multierror"
18-
1916
"github.com/shirou/gopsutil/v4/mem"
2017
"github.com/stretchr/testify/assert"
2118
)
@@ -118,16 +115,7 @@ func TestVirtualMemoryStat(t *testing.T) {
118115
virtualMemoryStat, err := cgroupCPUSource.VirtualMemoryStat()
119116

120117
// Assert error
121-
if err != nil {
122-
var multiError *multierror.Error
123-
if errors.As(err, &multiError) {
124-
assert.IsType(tt, test.errorType, multiError.Errors[0])
125-
} else {
126-
assert.IsType(tt, test.errorType, err)
127-
}
128-
} else {
129-
assert.IsType(tt, test.errorType, err)
130-
}
118+
assert.IsType(tt, test.errorType, err)
131119

132120
// Assert result
133121
assert.Equal(tt, test.virtualMemoryStat, *virtualMemoryStat)

internal/collector/containermetricsreceiver/internal/utils.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import (
1111
"os"
1212
"strconv"
1313
"strings"
14-
15-
"github.com/hashicorp/go-multierror"
1614
)
1715

1816
type Source interface {
@@ -29,7 +27,9 @@ func ReadLinesOffsetN(filename string, offset uint, n int) (lines []string, err
2927
defer func() {
3028
closeErr := f.Close()
3129
if closeErr != nil {
32-
err = multierror.Append(err, closeErr)
30+
if err == nil {
31+
err = closeErr
32+
}
3333
}
3434
}()
3535

0 commit comments

Comments
 (0)