Claude Code Claude Opus 4.6 commited on
Commit
e6594d0
·
1 Parent(s): 9a6065d

Claude Code: Verify /metrics endpoint - add enhanced error logging

Browse files

- Confirmed psutil==6.1.1 in requirements.txt
- Confirmed /metrics endpoint properly registered with FastAPI
- Added exc_info=True to error logging for full traceback on failures
- All error handling paths verified and working

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -75,6 +75,7 @@ def get_app():
75
  try:
76
  import psutil
77
  except ImportError:
 
78
  return JSONResponse(
79
  status_code=503,
80
  content={"error": "psutil not installed", "message": "System metrics unavailable"}
@@ -101,7 +102,7 @@ def get_app():
101
  }
102
  }
103
  except Exception as e:
104
- logger.error(f"Error collecting metrics: {e}")
105
  return JSONResponse(
106
  status_code=500,
107
  content={"error": "Failed to collect metrics", "message": str(e)}
 
75
  try:
76
  import psutil
77
  except ImportError:
78
+ logger.error("psutil not installed - metrics unavailable")
79
  return JSONResponse(
80
  status_code=503,
81
  content={"error": "psutil not installed", "message": "System metrics unavailable"}
 
102
  }
103
  }
104
  except Exception as e:
105
+ logger.error(f"Error collecting metrics: {e}", exc_info=True)
106
  return JSONResponse(
107
  status_code=500,
108
  content={"error": "Failed to collect metrics", "message": str(e)}