Repository navigation
fix(cli): cluster service reads retry a transient 503 - #5549
Conversation
A short outage of a cluster service ended a devops command with a traceback. Prometheus answered 503 for some seconds after its pod started again after a node drain, and `devops prometheus query` stopped with `httpx2.HTTPStatusError` (#5532). - The `retries` option of `http_client` also takes a `ReadRetryPolicy`. `SERVICE_READ_RETRY` sends a GET, HEAD or OPTIONS request again after 429, 502, 503, 504 or a failed connect or read: at most 4 attempts, jittered backoff that obeys Retry-After, and no attempt after 20 s. It sends no other method again, and it gives the last reply or error as one attempt does. The loop is tenacity.Retrying; the pydantic-ai transport costs 0.55 s of imports and closes the reply of a failed status. - `service_error` maps the last failure to one `ServiceRequestError` line: the service, the status or the network error, the attempts, the time and a hint. A reply with an error text adds it, so a refused PromQL query shows the error of Prometheus (#5487). - PrometheusClient, the Loki metric queries, GrafanaClient and get_json use the policy. The health gate and the rollout gate catch the mapped error; the health gate keeps its own wait loop. - reaches_service, the forward poll and the dashboard telemetry panel keep one attempt, because each must report down fast. - A pooled client keys on its retry option.
…e line devops k8s service-url --fetch printed the address of the service two times, because it put a prefix before the line of ServiceRequestError. The command now prints the line as it is. An error text of a reply with line breaks, or with its own full stop, made more than one line or two full stops. service_error now puts the detail and the network error text on one line with no full stop at the end.
Checks and review notesTests (rebased on origin/main 83f3656):
Render diff: no path under Fixes of the review (commit "print the service error line once and keep its detail on one line"):
Contracts that keep one attempt:
Behavior changes:
#5487: its acceptance test is Live check after the release: stop the Prometheus pod, then run |
🤖 I have created a release *beep* *boop* --- ## [0.132.1](v0.132.0...v0.132.1) (2026-11-13) ### Bug Fixes * **cli:** cluster service reads retry a transient 503 ([#5549](#5549)) ([0ae1ce5](0ae1ce5)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
A cluster service that is not ready for some seconds, such as Prometheus after a node drain, ended a devops command with a traceback. The Prometheus client, the Loki metric queries of
devops roadmap eval grades, the Grafana client andget_jsonnow read with one policy,SERVICE_READ_RETRY, on theretriesoption ofhttp_client. It sends a GET again after 429, 502, 503, 504 or a failed connect or read: at most 4 attempts, jittered backoff,Retry-After, no attempt after 20 s. Other methods, other 4xx and egress refusals are sent once.service_errormaps the last failure to oneServiceRequestErrorline with the attempts, the time and a hint. A Prometheus 400 shows itserror(Refs #5487).reaches_service, the forward poll and the telemetry panel keep one attempt: each must report down fast. The apply health gate keeps its wait loop. A release is necessary.Closes #5532
Change:
openspec/changes/archive/2026-11-13-5532-cluster-service-reads-retry-a-transient/