mirror of
https://github.com/fluxcd/flagger.git
synced 2026-03-03 02:00:18 +00:00
Include HTTP status code in Prometheus error responses
When Prometheus returns an HTTP error (4xx/5xx), the error message now includes the status code and reason phrase. Previously, only the response body was shown, which made it difficult to diagnose issues like HTTP 403 errors caused by missing authorization policies. Fixes fluxcd/flagger#1434 Signed-off-by: rohansood10 <rohansood10@users.noreply.github.com>
This commit is contained in:
@@ -143,7 +143,7 @@ func (p *PrometheusProvider) RunQuery(query string) (float64, error) {
|
||||
}
|
||||
|
||||
if 400 <= r.StatusCode {
|
||||
return 0, fmt.Errorf("error response: %s", string(b))
|
||||
return 0, fmt.Errorf("error response: Status %d %s: %s", r.StatusCode, http.StatusText(r.StatusCode), string(b))
|
||||
}
|
||||
|
||||
var result prometheusResponse
|
||||
|
||||
Reference in New Issue
Block a user