Ajay Tripathy vor 4 Jahren
Ursprung
Commit
28ba1bfa16
3 geänderte Dateien mit 3 neuen und 3 gelöschten Zeilen
  1. 1 1
      pkg/prom/query.go
  2. 1 1
      pkg/util/retry/retry.go
  3. 1 1
      pkg/util/strings.go

+ 1 - 1
pkg/prom/query.go

@@ -190,7 +190,7 @@ func (ctx *Context) query(query string) (interface{}, prometheus.Warnings, error
 	statusCode := resp.StatusCode
 	statusText := http.StatusText(statusCode)
 	if resp.StatusCode < 200 || resp.StatusCode >= 300 {
-		return nil, warnings, CommErrorf("%d (%s) URL: '%s' Headers: '%s', Body: '%s' Query: '%s'", statusCode, statusText, req.URL, util.HeaderString(resp.Header), body, query)
+		return nil, warnings, fmt.Errorf("%d (%s) URL: '%s', Request Headers: '%s', Headers: '%s', Body: '%s' Query: '%s'", statusCode, statusText, req.URL, req.Header, util.HeaderString(resp.Header), body, query)
 	}
 
 	var toReturn interface{}

+ 1 - 1
pkg/util/retry/retry.go

@@ -36,7 +36,7 @@ func Retry(ctx context.Context, f func() (interface{}, error), attempts uint, de
 
 		time.Sleep(d)
 
-		jitter := time.Duration(rand.Int63n(int64(d)))
+		jitter := time.Duration(rand.Int63n(int64(d))) // #nosec No need for a cryptographic strength random here
 		d = d + jitter/2
 	}
 

+ 1 - 1
pkg/util/strings.go

@@ -30,7 +30,7 @@ const (
 func RandSeq(n int) string {
 	b := make([]rune, n)
 	for i := range b {
-		b[i] = alpha[rand.Intn(len(alpha))]
+		b[i] = alpha[rand.Intn(len(alpha))] // #nosec No need for a cryptographic strength random here
 	}
 	return string(b)
 }