fix(input/prometheus): move err check to correct place (#9920)
This commit is contained in:
parent
97e19ebd55
commit
432b30d2e9
|
|
@ -154,12 +154,11 @@ func (p *Prometheus) cAdvisor(ctx context.Context, bearerToken string) error {
|
|||
// The request will be the same each time
|
||||
podsURL := fmt.Sprintf("https://%s:10250/pods", p.NodeIP)
|
||||
req, err := http.NewRequest("GET", podsURL, nil)
|
||||
req.Header.Set("Authorization", "Bearer "+bearerToken)
|
||||
req.Header.Add("Accept", "application/json")
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("error when creating request to %s to get pod list: %w", podsURL, err)
|
||||
}
|
||||
req.Header.Set("Authorization", "Bearer "+bearerToken)
|
||||
req.Header.Add("Accept", "application/json")
|
||||
|
||||
// Update right away so code is not waiting the length of the specified scrape interval initially
|
||||
err = updateCadvisorPodList(p, req)
|
||||
|
|
|
|||
Loading…
Reference in New Issue