Przeglądaj źródła

Merge pull request #1081 from kubecost/bolt/prom-response-nil-check

Prometheus Response Nil Check
Matt Bolt 4 lat temu
rodzic
commit
8897aa09dc
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      pkg/prom/prom.go

+ 1 - 1
pkg/prom/prom.go

@@ -267,7 +267,7 @@ func (rlpc *RateLimitedPrometheusClient) worker() {
 			// * Check for a 429 StatusCode OR 400 StatusCode and message containing "ThrottlingException"
 			// * Check for a 429 StatusCode OR 400 StatusCode and message containing "ThrottlingException"
 			// * Attempt to parse a Retry-After from response headers (common on 429)
 			// * Attempt to parse a Retry-After from response headers (common on 429)
 			// * If we couldn't determine how long to wait for a retry, use 1 second by default
 			// * If we couldn't determine how long to wait for a retry, use 1 second by default
-			if retryRateLimit {
+			if res != nil && retryRateLimit {
 				var status []*RateLimitResponseStatus
 				var status []*RateLimitResponseStatus
 				var retries int = retryOpts.MaxRetries
 				var retries int = retryOpts.MaxRetries
 				var defaultWait time.Duration = retryOpts.DefaultRetryWait
 				var defaultWait time.Duration = retryOpts.DefaultRetryWait