DOCS/troubleshooting/250914_admin_robeing_monitor_schema_error.md
happybell80 b902797eec docs: robeing-monitor 스키마 오류 정확한 정보 업데이트
- 서비스 위치: 51124:9024
- Gateway 호출 경로 및 라인 번호 추가
- DB 테이블/컬럼 불일치 상세 정보
- 수정 필요 파일 경로 명시
- API 엔드포인트 목록 추가
2025-09-15 12:51:44 +09:00

3.3 KiB

robeing-monitor DB 스키마 불일치

작성일: 2025-09-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 에러 발생

에러 로그

sqlalchemy.exc.ProgrammingError: column robeing.robeing_id does not exist
LINE 1: SELECT robeing.id AS robeing_id_1, robeing.robeing_id AS rob...

원인

robeing-monitor가 잘못된 테이블/컬럼 조회

  • 코드 예상: robeing_stats 테이블의 robeing_id 컬럼
  • 실제 DB: robeing 테이블의 robeing_container_id 컬럼

현재 영향

  • /api/stats/{robeing_id} 엔드포인트 실패 (500 에러)
  • Gateway 프록시: http://192.168.219.52:9024/api/stats/rb8001 호출 실패

Gateway에서 robeing-monitor 호출 경로

# /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}"

@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")

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 서버)

-- 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 쿼리 분석:

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_statsrobeing
  2. 컬럼명: robeing_idrobeing_container_id
  3. SQLAlchemy 모델 정의 수정

테스트:

# 51124 서버에서
curl http://192.168.219.52:9024/api/stats/rb8001