From b902797eec74a32b025b40a0d67f8e340f16450a Mon Sep 17 00:00:00 2001 From: happybell80 Date: Mon, 15 Sep 2025 12:51:44 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20robeing-monitor=20=EC=8A=A4=ED=82=A4?= =?UTF-8?q?=EB=A7=88=20=EC=98=A4=EB=A5=98=20=EC=A0=95=ED=99=95=ED=95=9C=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 서비스 위치: 51124:9024 - Gateway 호출 경로 및 라인 번호 추가 - DB 테이블/컬럼 불일치 상세 정보 - 수정 필요 파일 경로 명시 - API 엔드포인트 목록 추가 --- ...0914_admin_robeing_monitor_schema_error.md | 109 +++++++++++++----- 1 file changed, 81 insertions(+), 28 deletions(-) diff --git a/troubleshooting/250914_admin_robeing_monitor_schema_error.md b/troubleshooting/250914_admin_robeing_monitor_schema_error.md index 1339d20..6ef2814 100644 --- a/troubleshooting/250914_admin_robeing_monitor_schema_error.md +++ b/troubleshooting/250914_admin_robeing_monitor_schema_error.md @@ -4,8 +4,14 @@ ## 작성자: admin ## 환경: 51124 서버, robeing-monitor, PostgreSQL +## 서비스 정보 +- **서버**: 51124 (192.168.219.52) +- **포트**: 9024 +- **컨테이너**: robeing_monitor (38시간 가동 중, healthy) +- **DB 연결**: postgresql://robeings:robeings@192.168.219.45:5432/main_db + ## 문제 증상 -Gateway에서 stats API 호출 시 매분마다 500 에러 발생, preferences 호출 시 "column \"slack_user_id\" does not exist" 오류 발생 +Gateway에서 stats API 호출 시 매분마다 500 에러 발생 ### 에러 로그 ``` @@ -14,39 +20,86 @@ LINE 1: SELECT robeing.id AS robeing_id_1, robeing.robeing_id AS rob... ``` ## 원인 -robeing-monitor 코드가 존재하지 않는 컬럼 조회 -- 코드: `robeing.robeing_id` 컬럼 요청 -- DB: 해당 컬럼 없음 +robeing-monitor가 잘못된 테이블/컬럼 조회 +- **코드 예상**: `robeing_stats` 테이블의 `robeing_id` 컬럼 +- **실제 DB**: `robeing` 테이블의 `robeing_container_id` 컬럼 ## 현재 영향 -- `/api/stats/rb8001` 엔드포인트 실패 -- Gateway가 기본값 반환으로 우회 처리 중 -- 사용자: happybell80 (UUID: 53529291-5050-4daa-89fb-008b546feb63) +- `/api/stats/{robeing_id}` 엔드포인트 실패 (500 에러) +- Gateway 프록시: `http://192.168.219.52:9024/api/stats/rb8001` 호출 실패 -## 해결 방법 -로컬 개발자 작업 필요: +## Gateway에서 robeing-monitor 호출 경로 +```python +# /home/admin/robeing-gateway/app/main.py +@app.get("/api/stats/{robeing_id}") # 라인 296-297 +target_url = f"http://192.168.219.52:9024/api/stats/{robeing_id}" -1. robeing 테이블 스키마 확인 -```sql -\d robeing +@app.api_route("/api/preferences/{path:path}") # 라인 364-391 +monitor_url = "http://192.168.219.52:9024" + +@app.api_route("/api/items/{path:path}") # 라인 150-167 +monitor_url = os.getenv("MONITOR_URL", "http://192.168.219.52:9024") ``` -2. robeing_id 컬럼 추가 또는 코드 수정 -```sql --- 옵션 1: 컬럼 추가 -ALTER TABLE robeing ADD COLUMN robeing_id VARCHAR(50); - --- 옵션 2: 코드에서 기존 컬럼 사용 --- id 또는 다른 식별자 컬럼 사용하도록 수정 -``` - -3. robeing-monitor 재배포 - -## 관련 정보 -- Gateway 로그: 매분 실패 기록 -- 51124 서버: robeing_monitor 컨테이너 16시간 가동 중 -- DB: main_db PostgreSQL - - 참고: preferences 연동 문서(DOCS/troubleshooting/250827_frontend_backend_preferences_API_연동_완료.md) +## robeing-monitor 제공 API +- `GET /api/stats/{robeing_id}` - 로빙 스탯 조회 (500 에러) +- `PUT /api/stats/{robeing_id}` - 스탯 업데이트 +- `GET /api/preferences/{user_id}` - 사용자 설정 +- `PUT /api/preferences/{user_id}` - 설정 업데이트 +- `GET /api/items/gmail` - Gmail 아이템 조회 +- `GET /healthz` - 헬스체크 (정상) ## 상태 🔴 미해결 - 로컬 개발자 작업 대기 + +## 2025-09-15 업데이트 + +### DB 스키마 확인 (51123 서버) +```sql +-- robeing 테이블 실제 구조 +id | uuid +product_id | uuid +team_id | uuid +name | varchar(32) +level | integer +experience | integer +memory | integer +compute | integer +react | integer +empathy | integer +leadership | integer +updated_at | timestamp +created_at | timestamp +robeing_container_id | varchar(64) +robeing_container_url | varchar(128) +``` + +### 확인된 사실 +- **robeing_id 컬럼 없음** 확인 +- robeing-monitor는 51124 서버에서 실행 중 +- 51123 서버 DB에는 id(UUID) 컬럼만 존재 + +### 문제 원인 분석 +SQLAlchemy 쿼리 분석: +```sql +SELECT robeing.id AS robeing_id_1, robeing.robeing_id AS rob... +``` +- robeing.id를 robeing_id_1로 별칭 처리 +- 존재하지 않는 robeing.robeing_id 컬럼도 조회 시도 +- **원인**: robeing-monitor의 SQLAlchemy 모델에 id와 robeing_id 둘 다 정의됨 + +### 해결 방안 +**robeing-monitor 수정 필요 파일**: +- `/home/admin/ivada_project/robeing-monitor/app/state/database.py` +- `/home/admin/ivada_project/robeing-monitor/app/state/state_service.py` + +**수정 내용**: +1. 테이블명: `robeing_stats` → `robeing` +2. 컬럼명: `robeing_id` → `robeing_container_id` +3. SQLAlchemy 모델 정의 수정 + +**테스트**: +```bash +# 51124 서버에서 +curl http://192.168.219.52:9024/api/stats/rb8001 +```