Skip to content

Commit

Permalink
Add proper metrics when retries are exhausted
Browse files Browse the repository at this point in the history
  • Loading branch information
migueleliasweb authored and jimmidyson committed Jul 7, 2020
1 parent 3d75026 commit 73884be
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions configmap-reload.go
Expand Up @@ -115,6 +115,9 @@ func main() {
req.SetBasicAuth(userInfo.Username(), password)
}
}

successfulReloadWebhook := false

for retries := *webhookRetries; retries != 0; retries-- {
log.Printf("performing webhook request (%d/%d)", retries, *webhookRetries)
resp, err := http.DefaultClient.Do(req)
Expand All @@ -132,10 +135,17 @@ func main() {
time.Sleep(time.Second * 10)
continue
}

setSuccessMetrict(h.String(), begun)
log.Println("successfully triggered reload")
successfulReloadWebhook = true
break
}

if !successfulReloadWebhook {
setFailureMetrics(h.String(), "retries_exhausted")
log.Println("error:", "Webhook reload retries exhausted")
}
}
case err := <-watcher.Errors:
watcherErrors.Inc()
Expand Down

0 comments on commit 73884be

Please sign in to comment.