From 416166b07cc8e6787f42d68e0e496011e272a98a Mon Sep 17 00:00:00 2001 From: Jack Kingsman Date: Tue, 31 Mar 2026 23:09:12 -0700 Subject: [PATCH] Add system arch data to debug output --- app/routers/debug.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/app/routers/debug.py b/app/routers/debug.py index f7573e9..53ae228 100644 --- a/app/routers/debug.py +++ b/app/routers/debug.py @@ -1,5 +1,8 @@ import hashlib import logging +import os +import platform +import struct import sys from datetime import datetime, timezone from typing import Any @@ -34,6 +37,13 @@ LOG_COPY_BOUNDARY_PREFIX = [ ] +class DebugSystemInfo(BaseModel): + os: str + arch: str + arch_bits: int + total_ram_mb: int + + class DebugApplicationInfo(BaseModel): version: str version_source: str @@ -95,6 +105,7 @@ class DebugDatabaseInfo(BaseModel): class DebugSnapshotResponse(BaseModel): captured_at: str + system: DebugSystemInfo application: DebugApplicationInfo health: HealthResponse runtime: DebugRuntimeInfo @@ -103,6 +114,23 @@ class DebugSnapshotResponse(BaseModel): logs: list[str] +def _build_system_info() -> DebugSystemInfo: + try: + # os.sysconf is available on Linux/macOS + page_size = os.sysconf("SC_PAGE_SIZE") + page_count = os.sysconf("SC_PHYS_PAGES") + total_ram_mb = (page_size * page_count) // (1024 * 1024) + except (AttributeError, ValueError, OSError): + total_ram_mb = 0 + + return DebugSystemInfo( + os=f"{platform.system()} {platform.release()}", + arch=platform.machine(), + arch_bits=struct.calcsize("P") * 8, + total_ram_mb=total_ram_mb, + ) + + def _build_application_info() -> DebugApplicationInfo: build_info = get_app_build_info() dirty_output = git_output("status", "--porcelain") @@ -272,6 +300,7 @@ async def debug_support_snapshot() -> DebugSnapshotResponse: ) return DebugSnapshotResponse( captured_at=datetime.now(timezone.utc).isoformat(), + system=_build_system_info(), application=_build_application_info(), health=HealthResponse(**health_data), runtime=DebugRuntimeInfo(