From 0f850400f2f954c2f39b7fed79f8782610459268 Mon Sep 17 00:00:00 2001 From: Song Wenhao Date: Thu, 6 Jul 2017 05:28:44 +0800 Subject: [PATCH] Display error message if prometheus output fails to listen (#2984) --- plugins/outputs/prometheus_client/prometheus_client.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/outputs/prometheus_client/prometheus_client.go b/plugins/outputs/prometheus_client/prometheus_client.go index f16824c9e..f858c6350 100644 --- a/plugins/outputs/prometheus_client/prometheus_client.go +++ b/plugins/outputs/prometheus_client/prometheus_client.go @@ -78,7 +78,12 @@ func (p *PrometheusClient) Start() error { Handler: mux, } - go p.server.ListenAndServe() + go func() { + if err := p.server.ListenAndServe(); err != nil { + log.Printf("E! Error creating prometheus metric endpoint, err: %s\n", + err.Error()) + } + }() return nil }