Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions issues/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,13 @@ func getOrgAndRepoFromIssue(issue *github.Issue) (string, string, error) {

func updateRateMetrics(api string, resp *github.Response, err error) {
// Update rate limit metrics.
rateLimit.WithLabelValues(api).Set(float64(resp.Rate.Limit))
rateRemaining.WithLabelValues(api).Set(float64(resp.Rate.Remaining))
rateResetTime.WithLabelValues(api).Set(float64(resp.Rate.Reset.UTC().Unix()))
// Count the number of API operations per HTTP Status.
operationCount.WithLabelValues(resp.Status).Inc()
if resp != nil {
rateLimit.WithLabelValues(api).Set(float64(resp.Rate.Limit))
rateRemaining.WithLabelValues(api).Set(float64(resp.Rate.Remaining))
rateResetTime.WithLabelValues(api).Set(float64(resp.Rate.Reset.UTC().Unix()))
// Count the number of API operations per HTTP Status.
operationCount.WithLabelValues(resp.Status).Inc()
}
// If the err is a RateLimitError, then increment the rateError counter.
if _, ok := err.(*github.RateLimitError); ok {
log.Println("Hit rate limit!")
Expand Down