You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(prometheus): a query that Prometheus refuses ends in a traceback #5487
devops prometheus query ends in a Python traceback when Prometheus refuses a query with HTTP 400. The local syntax check passes the query, so the server finds the error. The command prints HTTPStatusError: Client error '400 Bad Request' for url ... and does not print the error message of Prometheus, which tells what is wrong. The traceback also prints the full URL of the Prometheus host.
Reproduction Steps
uv run devops prometheus query 'up * on (job) group_left (up == 1)'
The command exits 1 with a 77-line traceback through src/devops_cli/commands/prometheus.py:144 (query) and src/devops_cli/prometheus/client.py:137 (_get_json).
Expected vs Actual Behavior
Expected: one error line with the error field of the Prometheus response (for example a parse error and its position), and exit code 1.
Actual: a traceback that ends in HTTPStatusError, with no message from Prometheus.
Environment Diagnostics
devops-cli from main on 2026-11-13.
Proposed Solution
Map an HTTP 4xx response of the Prometheus API to a DevOpsCLIError subclass that holds the errorType and the error fields of the JSON body, as the Prometheus HTTP API documents.
Acceptance Criteria
A test proves that a 400 response with an error field prints that error in one line and exits 1, with no traceback.
Related
Found while measuring docs/K8S_PERFORMANCE.md (#5444).
Scope: none. The title has the scope prometheus, and .github/labels.yml declares no scope/prometheus label. Add the label to the file to give the scope to this item.
Delivered by #5549 (merged 2026-11-13). A Prometheus 400 now prints its errorType and error fields in one line, exits 1 and prints no traceback. Test: tests/commands/test_prometheus.py::test_a_query_that_prometheus_refuses_prints_its_error. The PR body named this issue with Refs only, because the readiness check refuses a body that closes two issues. The fix ships in the next release.
Activity
dan-petty commentedon Nov 13, 2026
prometheus, and .github/labels.yml declares no scope/prometheus label. Add the label to the file to give the scope to this item.Both items handle Prometheus query errors, but #314 adds client-side validation before sending, while the candidate handles the server's 400 response after receiving it.fix(cli): cluster service reads retry a transient 503 (#5549)
dan-petty commentedon Nov 13, 2026
Delivered by #5549 (merged 2026-11-13). A Prometheus 400 now prints its
errorTypeanderrorfields in one line, exits 1 and prints no traceback. Test:tests/commands/test_prometheus.py::test_a_query_that_prometheus_refuses_prints_its_error. The PR body named this issue with Refs only, because the readiness check refuses a body that closes two issues. The fix ships in the next release.