feat: let different services start prometheus on demand (#1182)

This commit is contained in:
Kevin Wan
2021-10-31 18:54:13 +08:00
committed by GitHub
parent 769d06c8ab
commit a71a210704

View File

@@ -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())