disable collector correctly
This commit is contained in:
parent
3384cc92e7
commit
52468bb63e
@ -46,9 +46,6 @@ func (settings *AppSettings) validateFlags() {
|
|||||||
minServerPort, maxServerPort, settings.MetricsPort)
|
minServerPort, maxServerPort, settings.MetricsPort)
|
||||||
flagsValid = false
|
flagsValid = false
|
||||||
}
|
}
|
||||||
if settings.FileCollectorPath != "" {
|
|
||||||
settings.FileCollectorEnabled = true
|
|
||||||
}
|
|
||||||
if settings.FileCollectorEnabled && settings.FileCollectorPath == "" {
|
if settings.FileCollectorEnabled && settings.FileCollectorPath == "" {
|
||||||
fmt.Printf("file collector directory path must not be empty if collector enabled\n")
|
fmt.Printf("file collector directory path must not be empty if collector enabled\n")
|
||||||
flagsValid = false
|
flagsValid = false
|
||||||
|
@ -9,6 +9,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (c *Collector) WriteTextFileMetrics(w http.ResponseWriter, r *http.Request) {
|
func (c *Collector) WriteTextFileMetrics(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if !c.enabled {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
files, err := ioutil.ReadDir(c.folderPath)
|
files, err := ioutil.ReadDir(c.folderPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.appendErrorForPath(c.folderPath)
|
c.appendErrorForPath(c.folderPath)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user