Skip to content
Snippets Groups Projects
Commit 82ea04f1 authored by Daniel Nelson's avatar Daniel Nelson Committed by GitHub
Browse files

Fix prometheus output cannot be reloaded (#3053)

parent 273d0b85
No related branches found
No related tags found
No related merge requests found
...@@ -80,8 +80,10 @@ func (p *PrometheusClient) Start() error { ...@@ -80,8 +80,10 @@ func (p *PrometheusClient) Start() error {
go func() { go func() {
if err := p.server.ListenAndServe(); err != nil { if err := p.server.ListenAndServe(); err != nil {
log.Printf("E! Error creating prometheus metric endpoint, err: %s\n", if err != http.ErrServerClosed {
err.Error()) log.Printf("E! Error creating prometheus metric endpoint, err: %s\n",
err.Error())
}
} }
}() }()
return nil return nil
...@@ -99,7 +101,9 @@ func (p *PrometheusClient) Connect() error { ...@@ -99,7 +101,9 @@ func (p *PrometheusClient) Connect() error {
func (p *PrometheusClient) Close() error { func (p *PrometheusClient) Close() error {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel() defer cancel()
return p.server.Shutdown(ctx) err := p.server.Shutdown(ctx)
prometheus.Unregister(p)
return err
} }
func (p *PrometheusClient) SampleConfig() string { func (p *PrometheusClient) SampleConfig() string {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment