Skip to content

Commit

Permalink
Log cleanup: remove spam, set proper levels, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
robbiet480 authored Aug 11, 2018
1 parent 3f93884 commit 52d0891
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,8 @@ func (p *Prometheus) getPushGatewayURL() string {
func (p *Prometheus) sendMetricsToPushGateway(metrics []byte) {
req, err := http.NewRequest("POST", p.getPushGatewayURL(), bytes.NewBuffer(metrics))
client := &http.Client{}
_, err = client.Do(req)
if err != nil {
log.Error("Error sending to push gatway: " + err.Error())
if _, err = client.Do(req); err != nil {
log.WithError(err).Errorln("Error sending to push gateway")
}
}

Expand Down Expand Up @@ -318,9 +317,7 @@ func (p *Prometheus) registerMetrics(subsystem string) {
for _, metricDef := range p.MetricsList {
metric := NewMetric(metricDef, subsystem)
if err := prometheus.Register(metric); err != nil {
log.Infof("%s could not be registered: ", metricDef.Name, err)
} else {
log.Infof("%s registered.", metricDef.Name)
log.WithError(err).Errorf("%s could not be registered in Prometheus", metricDef.Name)
}
switch metricDef {
case reqCnt:
Expand Down

0 comments on commit 52d0891

Please sign in to comment.