Skip to content

Commit 74a90e8

Browse files
authored
Merge pull request #1486 from mknapphrt/mount_timeout
Add a flag to adjust mount timeout
2 parents 9f49fff + c9603c6 commit 74a90e8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

collector/filesystem_linux.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@ import (
2626

2727
"github.com/prometheus/common/log"
2828
"golang.org/x/sys/unix"
29+
kingpin "gopkg.in/alecthomas/kingpin.v2"
2930
)
3031

3132
const (
3233
defIgnoredMountPoints = "^/(dev|proc|sys|var/lib/docker/.+)($|/)"
3334
defIgnoredFSTypes = "^(autofs|binfmt_misc|bpf|cgroup2?|configfs|debugfs|devpts|devtmpfs|fusectl|hugetlbfs|iso9660|mqueue|nsfs|overlay|proc|procfs|pstore|rpc_pipefs|securityfs|selinuxfs|squashfs|sysfs|tracefs)$"
34-
mountTimeout = 30 * time.Second
3535
)
3636

37+
var mountTimeout = kingpin.Flag("collector.filesystem.mount-timeout",
38+
"how long to wait for a mount to respond before marking it as stale").
39+
Hidden().Default("5s").Duration()
3740
var stuckMounts = make(map[string]struct{})
3841
var stuckMountsMtx = &sync.Mutex{}
3942

@@ -118,7 +121,7 @@ func stuckMountWatcher(mountPoint string, success chan struct{}) {
118121
select {
119122
case <-success:
120123
// Success
121-
case <-time.After(mountTimeout):
124+
case <-time.After(*mountTimeout):
122125
// Timed out, mark mount as stuck
123126
stuckMountsMtx.Lock()
124127
select {

0 commit comments

Comments
 (0)