siso: have siso.py control if collector creates socket file.

Bug: b/455433899
Change-Id: Ic02cd97ef3db59263859eeab5cd70f986a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7231248
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Commit-Queue: Alex Ovsienko <ovsienko@google.com>
This commit is contained in:
Alex Ovsienko
2025-12-09 01:16:10 -08:00
committed by LUCI CQ
parent fc502860ed
commit 6cd31a3b57
2 changed files with 71 additions and 32 deletions

11
siso.py
View File

@@ -139,8 +139,9 @@ def _start_collector(siso_path: str, sockets_file: Optional[str],
class Status(Enum):
HEALTHY = 1
WRONG_ENDPOINT = 2
UNHEALTHY = 3
DEAD = 4
NO_SOCKETS = 3
UNHEALTHY = 4
DEAD = 5
def collector_status() -> Status:
conn = http.client.HTTPConnection(f"localhost:{_OTLP_HEALTH_PORT}")
@@ -161,6 +162,9 @@ def _start_collector(siso_path: str, sockets_file: Optional[str],
expected_endpoint = sockets_file or _OTLP_DEFAULT_TCP_ENDPOINT
if endpoint != expected_endpoint:
return Status.WRONG_ENDPOINT
if sockets_file:
if not os.path.exists(sockets_file):
return Status.NO_SOCKETS
return Status.HEALTHY
@@ -215,6 +219,9 @@ def _start_collector(siso_path: str, sockets_file: Optional[str],
status = collector_status()
if status == Status.HEALTHY:
return True
# Non retriable error.
if status == Status.WRONG_ENDPOINT:
return False
time.sleep(0.05)
return False