siso: rarely, call to getresponse can also throw.

Cover it in try so that clients don't have to deal with fatal error.

Bug: b/455433899
Change-Id: Icd07e2057da19650a11981a8672c0e4c6a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7409014
Auto-Submit: Alex Ovsienko <ovsienko@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
This commit is contained in:
Alex Ovsienko
2026-01-07 21:17:41 -08:00
committed by LUCI CQ
parent 3ad54e4fef
commit 72926f8e78

View File

@@ -141,9 +141,9 @@ def _start_collector(siso_path: str, sockets_file: Optional[str],
conn = http.client.HTTPConnection(f"localhost:{_OTLP_HEALTH_PORT}")
try:
conn.request("GET", "/health/status")
response = conn.getresponse()
except ConnectionError:
return Status.DEAD
response = conn.getresponse()
if response.status != 200:
return Status.DEAD
@@ -163,8 +163,11 @@ def _start_collector(siso_path: str, sockets_file: Optional[str],
return Status.HEALTHY
def fetch_receiver_endpoint(conn: http.client.HTTPConnection) -> str:
conn.request("GET", "/health/config")
response = conn.getresponse()
try:
conn.request("GET", "/health/config")
response = conn.getresponse()
except ConnectionError:
return ""
resp_json = json.loads(response.read())
try:
return resp_json["receivers"]["otlp"]["protocols"]["grpc"][