Fix prometheus output cannot be reloaded (#3053)

This commit is contained in:
Daniel Nelson 2017-07-25 15:41:18 -07:00 committed by GitHub
parent f179cdbec7
commit a5c0dac37f
1 changed files with 7 additions and 3 deletions

View File

@ -80,9 +80,11 @@ func (p *PrometheusClient) Start() error {
go func() {
if err := p.server.ListenAndServe(); err != nil {
if err != http.ErrServerClosed {
log.Printf("E! Error creating prometheus metric endpoint, err: %s\n",
err.Error())
}
}
}()
return nil
}
@ -99,7 +101,9 @@ func (p *PrometheusClient) Connect() error {
func (p *PrometheusClient) Close() error {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
return p.server.Shutdown(ctx)
err := p.server.Shutdown(ctx)
prometheus.Unregister(p)
return err
}
func (p *PrometheusClient) SampleConfig() string {