Delay initial prometheus status metric

This commit is contained in:
Manuel de Brito Fontes 2018-07-30 09:56:09 -04:00 committed by Manuel Alejandro de Brito Fontes
parent 5e4137c6e7
commit 5e13de4a65
No known key found for this signature in database
GPG key ID: 786136016A8BA02A

View file

@ -18,6 +18,7 @@ package metric
import (
"os"
"time"
"github.com/prometheus/client_golang/prometheus"
@ -113,7 +114,12 @@ func (c *collector) Start() {
c.registry.MustRegister(c.ingressController)
c.registry.MustRegister(c.socket)
go c.nginxStatus.Start()
// the default nginx.conf does not contains
// a server section with the status port
go func() {
time.Sleep(5 * time.Second)
c.nginxStatus.Start()
}()
go c.nginxProcess.Start()
go c.socket.Start()
}