Merge pull request #91 from kongfei605/prometheus_panic_fix

[fix] prometheus config may be nil
This commit is contained in:
kongfei605 2022-07-13 11:45:22 +08:00 committed by GitHub
commit 0c369d9f36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import (
func (a *Agent) startPrometheusScrape() { func (a *Agent) startPrometheusScrape() {
if coreconfig.Config == nil || if coreconfig.Config == nil ||
coreconfig.Config.Prometheus == nil ||
!coreconfig.Config.Prometheus.Enable { !coreconfig.Config.Prometheus.Enable {
return return
} }
@ -18,6 +19,7 @@ func (a *Agent) startPrometheusScrape() {
func (a *Agent) stopPrometheusScrape() { func (a *Agent) stopPrometheusScrape() {
if coreconfig.Config == nil || if coreconfig.Config == nil ||
coreconfig.Config.Prometheus == nil ||
!coreconfig.Config.Prometheus.Enable { !coreconfig.Config.Prometheus.Enable {
return return
} }