Skip to content

Include HTTP status code in Prometheus error responses#1878

Merged
aryan9600 merged 1 commit intofluxcd:mainfrom
rohansood10:fix/1434-prometheus-error-messages
Mar 2, 2026
Merged

Include HTTP status code in Prometheus error responses#1878
aryan9600 merged 1 commit intofluxcd:mainfrom
rohansood10:fix/1434-prometheus-error-messages

Conversation

@rohansood10
Copy link
Contributor

Description

When Prometheus returns an HTTP error (4xx/5xx), the error message previously only included the response body, producing messages like:

Prometheus query failed: running query failed: error response:

This made it difficult to diagnose issues such as HTTP 403 errors caused by missing authorization policies (e.g., Linkerd's linkerdAuthPolicy.create=true).

This change includes the HTTP status code and reason phrase in the error message, producing clearer output like:

Prometheus query failed: running query failed: error response: Status 403 Forbidden:

Checklist

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#1434

Signed-off-by: rohansood10 <rohansood10@users.noreply.github.com>
@rohansood10 rohansood10 marked this pull request as ready for review February 22, 2026 18:03
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 30.01%. Comparing base (12ee6cb) to head (6a00963).
⚠️ Report is 81 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1878      +/-   ##
==========================================
- Coverage   39.44%   30.01%   -9.43%     
==========================================
  Files         287      287              
  Lines       22706    18460    -4246     
==========================================
- Hits         8956     5541    -3415     
+ Misses      12777    12188     -589     
+ Partials      973      731     -242     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aryan9600 aryan9600 merged commit b10e7cf into fluxcd:main Mar 2, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incomplete error messages obscure HTTP 403 issue when accessing prometheus

3 participants