Fix prometheus output cannot be reloaded (#3053)
This commit is contained in:
parent
f179cdbec7
commit
a5c0dac37f
|
@ -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 {
|
||||||
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 {
|
||||||
|
|
Loading…
Reference in New Issue