Skip to content

Commit 9668fd5

Browse files
craig[bot]dodeca12
andcommitted
Merge #152268
152268: storage: inline `recordStats` function in `linux_parse.go` to fix lint r=dodeca12 a=dodeca12 `./dev lint` runs a series of lint checks, which includes `TestLint/TestStaticCheck`; `TestLint/TestStaticCheck` throws an an error: ```log === RUN TestLint/TestStaticCheck gen-lint_test.go:2119: pkg/storage/disk/monitor.go:198:25: func (*monitoredDisk).recordStats is unused (U1000) ``` However, `recordStats` is used in `pkg/storage/disk/linux_parse.go` which has a `//go:build linux` constraint, so it is actually not "unused". This PR resolves the linter error by inlining the behaviour in `linux_parse.go` and removing the function from `monitor.go`. Epic: None Release note: None Co-authored-by: Swapneeth Gorantla <[email protected]>
2 parents d5a3905 + a13205d commit 9668fd5

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

pkg/storage/disk/linux_parse.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,11 @@ func parseDiskStats(
149149
} else if ok {
150150
stats.FlushesDuration = time.Duration(millis) * time.Millisecond
151151
}
152-
disks[diskIdx].recordStats(measuredAt, stats)
152+
disks[diskIdx].tracer.RecordEvent(traceEvent{
153+
time: measuredAt,
154+
stats: stats,
155+
err: nil,
156+
})
153157
countCollected++
154158
}
155159
return countCollected, nil

pkg/storage/disk/monitor.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,6 @@ type monitoredDisk struct {
195195
refCount int
196196
}
197197

198-
func (m *monitoredDisk) recordStats(t time.Time, stats Stats) {
199-
m.tracer.RecordEvent(traceEvent{
200-
time: t,
201-
stats: stats,
202-
err: nil,
203-
})
204-
}
205-
206198
// StatsWindow is a wrapper around a rolling window of disk stats, used to
207199
// apply common rudimentary computations or custom aggregation functions.
208200
type StatsWindow struct {

0 commit comments

Comments
 (0)