From 0a956ea6f3a09efe5e4d568f69829cfd5e781f3e Mon Sep 17 00:00:00 2001 From: Nico Hinderling Date: Thu, 3 Sep 2026 20:43:07 -0700 Subject: [PATCH] feat(size): Log the binary analysis pool size at INFO The worker count now comes from a sentry-option, but the only log that states it was at DEBUG, so nothing in Sentry Logs shows which value a build actually ran with. Emit it at INFO with a structured `workers` field so a region override can be verified from the build's logs. --- src/launchpad/size/analyzers/apple.py | 2 +- tests/integration/size/test_apple_app_sizes.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/launchpad/size/analyzers/apple.py b/src/launchpad/size/analyzers/apple.py index f0c578ad..162ffcb2 100644 --- a/src/launchpad/size/analyzers/apple.py +++ b/src/launchpad/size/analyzers/apple.py @@ -213,7 +213,7 @@ def analyze(self, artifact: AppleArtifact) -> AppleAnalysisResults: extract_dir=artifact.get_extract_dir(), ) if workers > 0: - logger.debug(f"Analyzing binaries with {workers} processes") + logger.info("size.apple.binary_analysis_workers", extra={"workers": workers}) executor = ProcessPoolExecutor( max_workers=workers, initializer=_binary_worker_init, diff --git a/tests/integration/size/test_apple_app_sizes.py b/tests/integration/size/test_apple_app_sizes.py index d24225cd..2e29a5bf 100644 --- a/tests/integration/size/test_apple_app_sizes.py +++ b/tests/integration/size/test_apple_app_sizes.py @@ -190,12 +190,17 @@ def test_parallel_binary_analysis_matches_in_process(self, hackernews_xcarchive: assert in_process.treemap.model_dump_json() == parallel.treemap.model_dump_json() def test_worker_logs_reach_stdout_with_request_id( - self, hackernews_xcarchive: Path, monkeypatch: pytest.MonkeyPatch, capfd: pytest.CaptureFixture[str] + self, + hackernews_xcarchive: Path, + monkeypatch: pytest.MonkeyPatch, + capfd: pytest.CaptureFixture[str], + caplog: pytest.LogCaptureFixture, ) -> None: """Uses spawn rather than forkserver: the forkserver inherits stdout once at startup, before capfd redirects it, so forkserver workers would write past the capture.""" ctx = mp.get_context("spawn") monkeypatch.setattr(apple, "ProcessPoolExecutor", functools.partial(ProcessPoolExecutor, mp_context=ctx)) + caplog.set_level(logging.INFO, logger=apple.logger.name) with request_context(): request_id = current_request_id() @@ -208,6 +213,8 @@ def test_worker_logs_reach_stdout_with_request_id( assert completed assert all(d["request_id"] == request_id for d in completed) assert all(isinstance(d["elapsed_s"], float) for d in completed) + pool = [r for r in caplog.records if r.getMessage() == "size.apple.binary_analysis_workers"] + assert [r.workers for r in pool] == [2] def test_worker_logging_applies_third_party_suppression(self, capfd: pytest.CaptureFixture[str]) -> None: ctx = mp.get_context("spawn")