Skip to content
Permalink
Browse files

[prometheus]: Fix register bug

  • Loading branch information
erbesharat committed Dec 11, 2019
1 parent d8c0429 commit e722eb8e44f9e7e2542e8b3e9882a5b5b790ec8e
Showing with 12 additions and 14 deletions.
  1. +12 −14 prometheus.go
@@ -95,20 +95,18 @@ func (p *Prometheus) SetDefaults() {
}

func (p *Prometheus) start() error {
once.Do(func() {
prometheus.MustRegister(RequestsCount)
prometheus.MustRegister(RequestsByStatus)
prometheus.MustRegister(RequestsCountBasedOnType)
prometheus.MustRegister(FallbacksCount)
prometheus.MustRegister(PathRedirectCount)
http.Handle(p.Path, p.handler)
go func() {
err := http.ListenAndServe(p.Address, nil)
if err != nil {
log.Printf("[txtdirect]: Couldn't start http handler for prometheus metrics. %s", err.Error())
}
}()
})
prometheus.MustRegister(RequestsCount)
prometheus.MustRegister(RequestsByStatus)
prometheus.MustRegister(RequestsCountBasedOnType)
prometheus.MustRegister(FallbacksCount)
prometheus.MustRegister(PathRedirectCount)
http.Handle(p.Path, p.handler)
go func() {
err := http.ListenAndServe(p.Address, nil)
if err != nil {
log.Printf("[txtdirect]: Couldn't start http handler for prometheus metrics. %s", err.Error())
}
}()
return nil
}

0 comments on commit e722eb8

Please sign in to comment.
You can’t perform that action at this time.