[fix] prometheus config may be nil

This commit is contained in:
kongfei 2022-07-13 11:43:03 +08:00
parent e1ae270db6
commit 21940fd7f5
1 changed files with 2 additions and 0 deletions

View File

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