docs: robeing-monitor 스키마 오류 정확한 정보 업데이트

- 서비스 위치: 51124:9024
- Gateway 호출 경로 및 라인 번호 추가
- DB 테이블/컬럼 불일치 상세 정보
- 수정 필요 파일 경로 명시
- API 엔드포인트 목록 추가
This commit is contained in:
happybell80 2025-09-15 12:51:44 +09:00
parent 1dd9ae697a
commit b902797eec

View File

@ -4,8 +4,14 @@
## 작성자: admin ## 작성자: admin
## 환경: 51124 서버, robeing-monitor, PostgreSQL ## 환경: 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-monitor가 잘못된 테이블/컬럼 조회
- 코드: `robeing.robeing_id` 컬럼 요청 - **코드 예상**: `robeing_stats` 테이블의 `robeing_id` 컬럼
- DB: 해당 컬럼 없음 - **실제 DB**: `robeing` 테이블의 `robeing_container_id` 컬럼
## 현재 영향 ## 현재 영향
- `/api/stats/rb8001` 엔드포인트 실패 - `/api/stats/{robeing_id}` 엔드포인트 실패 (500 에러)
- Gateway가 기본값 반환으로 우회 처리 중 - Gateway 프록시: `http://192.168.219.52:9024/api/stats/rb8001` 호출 실패
- 사용자: happybell80 (UUID: 53529291-5050-4daa-89fb-008b546feb63)
## 해결 방법 ## 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 테이블 스키마 확인 @app.api_route("/api/preferences/{path:path}") # 라인 364-391
```sql monitor_url = "http://192.168.219.52:9024"
\d robeing
@app.api_route("/api/items/{path:path}") # 라인 150-167
monitor_url = os.getenv("MONITOR_URL", "http://192.168.219.52:9024")
``` ```
2. robeing_id 컬럼 추가 또는 코드 수정 ## robeing-monitor 제공 API
```sql - `GET /api/stats/{robeing_id}` - 로빙 스탯 조회 (500 에러)
-- 옵션 1: 컬럼 추가 - `PUT /api/stats/{robeing_id}` - 스탯 업데이트
ALTER TABLE robeing ADD COLUMN robeing_id VARCHAR(50); - `GET /api/preferences/{user_id}` - 사용자 설정
- `PUT /api/preferences/{user_id}` - 설정 업데이트
-- 옵션 2: 코드에서 기존 컬럼 사용 - `GET /api/items/gmail` - Gmail 아이템 조회
-- id 또는 다른 식별자 컬럼 사용하도록 수정 - `GET /healthz` - 헬스체크 (정상)
```
3. robeing-monitor 재배포
## 관련 정보
- Gateway 로그: 매분 실패 기록
- 51124 서버: robeing_monitor 컨테이너 16시간 가동 중
- DB: main_db PostgreSQL
- 참고: preferences 연동 문서(DOCS/troubleshooting/250827_frontend_backend_preferences_API_연동_완료.md)
## 상태 ## 상태
🔴 미해결 - 로컬 개발자 작업 대기 🔴 미해결 - 로컬 개발자 작업 대기
## 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
```