Skip to content

Commit

Permalink
Fix prometheus output cannot be reloaded (#3053)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnelson authored Jul 25, 2017
1 parent 273d0b8 commit 82ea04f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions plugins/outputs/prometheus_client/prometheus_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ func (p *PrometheusClient) Start() error {

go func() {
if err := p.server.ListenAndServe(); err != nil {
log.Printf("E! Error creating prometheus metric endpoint, err: %s\n",
err.Error())
if err != http.ErrServerClosed {
log.Printf("E! Error creating prometheus metric endpoint, err: %s\n",
err.Error())
}
}
}()
return nil
Expand All @@ -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 {
Expand Down

0 comments on commit 82ea04f

Please sign in to comment.