From a71a210704d16e110406ef4d1176c59808ef4d8e Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Sun, 31 Oct 2021 18:54:13 +0800 Subject: [PATCH] feat: let different services start prometheus on demand (#1182) --- core/prometheus/agent.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/prometheus/agent.go b/core/prometheus/agent.go index 64f04bd8..1a294c88 100644 --- a/core/prometheus/agent.go +++ b/core/prometheus/agent.go @@ -23,11 +23,11 @@ func Enabled() bool { // StartAgent starts a prometheus agent. func StartAgent(c Config) { - once.Do(func() { - if len(c.Host) == 0 { - return - } + if len(c.Host) == 0 { + return + } + once.Do(func() { enabled.Set(true) threading.GoSafe(func() { http.Handle(c.Path, promhttp.Handler())