set default value for log level and web address
This commit is contained in:
parent
e083821da3
commit
072649941e
|
@ -1,8 +1,8 @@
|
||||||
global:
|
global:
|
||||||
scrape_interval: 15s
|
scrape_interval: 15s
|
||||||
external_labels:
|
#external_labels:
|
||||||
cluster: test
|
# cluster: test
|
||||||
replica: 0
|
# replica: 0
|
||||||
|
|
||||||
scrape_configs:
|
scrape_configs:
|
||||||
- job_name: "categraf-scrape-metrics"
|
- job_name: "categraf-scrape-metrics"
|
|
@ -1,7 +1,6 @@
|
||||||
[prometheus]
|
[prometheus]
|
||||||
enable=true
|
enable=true
|
||||||
scrape_config_file="/path/to/scrape.yaml"
|
scrape_config_file="/path/to/in_cluster_scrape.yaml"
|
||||||
web_address="127.0.0.1:9091"
|
|
||||||
##wal file storage path ,default ./data-agent
|
##wal file storage path ,default ./data-agent
|
||||||
# wal_storage_path="/path/to/storage"
|
# wal_storage_path="/path/to/storage"
|
||||||
##wal reserve time duration, default value is 2 hour
|
##wal reserve time duration, default value is 2 hour
|
||||||
|
|
|
@ -478,7 +478,15 @@ func Start() {
|
||||||
Registerer: prometheus.DefaultRegisterer,
|
Registerer: prometheus.DefaultRegisterer,
|
||||||
Gatherer: prometheus.DefaultGatherer,
|
Gatherer: prometheus.DefaultGatherer,
|
||||||
},
|
},
|
||||||
promlogConfig: promlog.Config{},
|
promlogConfig: promlog.Config{
|
||||||
|
Level: &promlog.AllowedLevel{},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
if coreconfig.Config.DebugMode || coreconfig.Config.TestMode {
|
||||||
|
cfg.promlogConfig.Level.Set("debug")
|
||||||
|
} else {
|
||||||
|
cfg.promlogConfig.Level.Set("info")
|
||||||
}
|
}
|
||||||
|
|
||||||
logger := promlog.New(&cfg.promlogConfig)
|
logger := promlog.New(&cfg.promlogConfig)
|
||||||
|
@ -544,7 +552,7 @@ func Start() {
|
||||||
|
|
||||||
cfg.web.ListenAddress = coreconfig.Config.Prometheus.WebAddress
|
cfg.web.ListenAddress = coreconfig.Config.Prometheus.WebAddress
|
||||||
if len(cfg.web.ListenAddress) == 0 {
|
if len(cfg.web.ListenAddress) == 0 {
|
||||||
cfg.web.ListenAddress = "127.0.0.1:9091"
|
cfg.web.ListenAddress = "127.0.0.1:0"
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg.web.ExternalURL, err = computeExternalURL(cfg.prometheusURL, cfg.web.ListenAddress)
|
cfg.web.ExternalURL, err = computeExternalURL(cfg.prometheusURL, cfg.web.ListenAddress)
|
||||||
|
@ -644,7 +652,7 @@ func Start() {
|
||||||
// Don't forget to release the reloadReady channel so that waiting blocks can exit normally.
|
// Don't forget to release the reloadReady channel so that waiting blocks can exit normally.
|
||||||
select {
|
select {
|
||||||
case sig := <-term:
|
case sig := <-term:
|
||||||
level.Warn(logger).Log("msg", "Received ", sig.String())
|
level.Warn(logger).Log("msg", "Received "+sig.String())
|
||||||
if sig != syscall.SIGPIPE {
|
if sig != syscall.SIGPIPE {
|
||||||
level.Warn(logger).Log("msg", "exiting gracefully...")
|
level.Warn(logger).Log("msg", "exiting gracefully...")
|
||||||
reloadReady.Close()
|
reloadReady.Close()
|
||||||
|
|
Loading…
Reference in New Issue