You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We already support reading from multiple directories though only using globs. Now we can specify them outright.
Example use case is exporting both static info on a RO FS generated during image building and traditional uses of textfiles (e.g. for R/W service metrics files) without scripting a file copy.
* keep flag name for compatibility
* clarify flag help text
* add test case (replicating the glob one)
Signed-off-by: eduarrrd <[email protected]>
Signed-off-by: Vitaly Zhuravlev <[email protected]>
Copy file name to clipboardExpand all lines: collector/textfile.go
+13-9Lines changed: 13 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -32,8 +32,8 @@ import (
32
32
)
33
33
34
34
var (
35
-
textFileDirectory=kingpin.Flag("collector.textfile.directory", "Directory to read text files with metrics from.").Default("").String()
36
-
mtimeDesc=prometheus.NewDesc(
35
+
textFileDirectories=kingpin.Flag("collector.textfile.directory", "Directory to read text files with metrics from, supports glob matching. (repeatable)").Default("").Strings()
36
+
mtimeDesc=prometheus.NewDesc(
37
37
"node_textfile_mtime_seconds",
38
38
"Unixtime mtime of textfiles successfully read.",
39
39
[]string{"file"},
@@ -42,7 +42,7 @@ var (
42
42
)
43
43
44
44
typetextFileCollectorstruct {
45
-
pathstring
45
+
paths []string
46
46
// Only set for testing to get predictable output.
0 commit comments