Skip to content

Commit

Permalink
Improve error handling in prometheus output (influxdata#5512)
Browse files Browse the repository at this point in the history
  • Loading branch information
glinton authored and danielnelson committed Mar 1, 2019
1 parent 9bd48d4 commit 30fcaf0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/outputs/prometheus_client/prometheus_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@ func (p *PrometheusClient) Connect() error {
}
}

registry.Register(p)
err := registry.Register(p)
if err != nil {
return err
}

if p.Listen == "" {
p.Listen = "localhost:9273"
Expand Down Expand Up @@ -301,6 +304,7 @@ func (p *PrometheusClient) Collect(ch chan<- prometheus.Metric) {
log.Printf("E! Error creating prometheus metric, "+
"key: %s, labels: %v,\nerr: %s\n",
name, labels, err.Error())
continue
}

if p.ExportTimestamp {
Expand Down

0 comments on commit 30fcaf0

Please sign in to comment.