docs: Gateway Stats API 슬래시 중복 문제 해결 내용 반영
- 문제: URL 조합 시 슬래시 3개 발생 (///api/stats/rb8001) - 해결: settings.get_monitor_stats_url() 메서드로 정규화 - 결과: 슬래시 정규화 완료, 200 OK 확인 - 상태: 미해결 → 해결 완료 (efca09f) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
269c96067d
commit
6c91a15a72
@ -61,15 +61,29 @@ docker inspect robeing-gateway auth-redis | grep -A2 "Networks"
|
||||
|
||||
---
|
||||
|
||||
## 6. 현재 상태 (2025-09-27)
|
||||
## 6. Stats API 슬래시 중복 문제 해결 (2025-09-27)
|
||||
|
||||
### Stats API 404 반복 발생
|
||||
### 문제
|
||||
- **증상**: `http://192.168.219.52:9024///api/stats/rb8001` 404 응답 (1분마다)
|
||||
- **URL 형식**: 슬래시 3개 (`///`) 발생 중
|
||||
- **현재 설정**:
|
||||
- `MONITOR_URL="http://192.168.219.52:9024"`
|
||||
- `MONITOR_STATUS_URI="/api/stats"`
|
||||
- **코드**: `main.py:290` - `f"{env_setting.MONITOR_URL}/{env_setting.MONITOR_STATUS_URI}/{robeing_id}"`
|
||||
- **실제 동작**: robeing-monitor API는 정상 (`curl http://localhost:9024/api/stats/rb8001` 성공)
|
||||
- **폴백**: 404 시 기본값 반환 중
|
||||
- **상태**: 미해결
|
||||
- **원인**: URL 조합 시 슬래시 중복 (`MONITOR_URL` 끝 + `MONITOR_STATUS_URI` 앞 + f-string 내부)
|
||||
- **기존 코드**: `main.py:290` - `f"{env_setting.MONITOR_URL}/{env_setting.MONITOR_STATUS_URI}/{robeing_id}"`
|
||||
|
||||
### 해결 방법
|
||||
**settings.py에 URL 생성 메서드 추가**:
|
||||
```python
|
||||
def get_monitor_stats_url(self, robeing_id: str) -> str:
|
||||
monitor_url = str(self.MONITOR_URL).rstrip('/') if self.MONITOR_URL else ""
|
||||
status_uri = self.MONITOR_STATUS_URI.strip('/') if self.MONITOR_STATUS_URI else ""
|
||||
return f"{monitor_url}/{status_uri}/{robeing_id}"
|
||||
```
|
||||
|
||||
**main.py 수정**:
|
||||
```python
|
||||
target_url = env_setting.get_monitor_stats_url(robeing_id)
|
||||
```
|
||||
|
||||
### 결과
|
||||
- ✅ 슬래시 정규화: `///` → `/`
|
||||
- ✅ URL 생성 로직 중앙화
|
||||
- ✅ 환경변수 설정 오류 방지
|
||||
- **상태**: 해결 완료 (efca09f)
|
||||
Loading…
x
Reference in New Issue
Block a user