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

master
Kevin Wan 3 years ago committed by GitHub
parent 769d06c8ab
commit a71a210704
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -23,11 +23,11 @@ func Enabled() bool {
// StartAgent starts a prometheus agent. // StartAgent starts a prometheus agent.
func StartAgent(c Config) { func StartAgent(c Config) {
once.Do(func() {
if len(c.Host) == 0 { if len(c.Host) == 0 {
return return
} }
once.Do(func() {
enabled.Set(true) enabled.Set(true)
threading.GoSafe(func() { threading.GoSafe(func() {
http.Handle(c.Path, promhttp.Handler()) http.Handle(c.Path, promhttp.Handler())

Loading…
Cancel
Save