Improve error handling in prometheus output (#5512)
This commit is contained in:
parent
9bd48d4673
commit
30fcaf0987
|
@ -176,7 +176,10 @@ func (p *PrometheusClient) Connect() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
registry.Register(p)
|
err := registry.Register(p)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if p.Listen == "" {
|
if p.Listen == "" {
|
||||||
p.Listen = "localhost:9273"
|
p.Listen = "localhost:9273"
|
||||||
|
@ -301,6 +304,7 @@ func (p *PrometheusClient) Collect(ch chan<- prometheus.Metric) {
|
||||||
log.Printf("E! Error creating prometheus metric, "+
|
log.Printf("E! Error creating prometheus metric, "+
|
||||||
"key: %s, labels: %v,\nerr: %s\n",
|
"key: %s, labels: %v,\nerr: %s\n",
|
||||||
name, labels, err.Error())
|
name, labels, err.Error())
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.ExportTimestamp {
|
if p.ExportTimestamp {
|
||||||
|
|
Loading…
Reference in New Issue