- Gateway Stats API URL 슬래시 3개 버그 (250926) - 51123 Fluent Bit 로그 유실 현황 (250918) - 000000 매트릭스에 Quick Wins 추가 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
75 lines
1.9 KiB
Markdown
75 lines
1.9 KiB
Markdown
# Gateway Redis 통합 및 Stats API 수정
|
|
|
|
## 날짜: 2025-09-26
|
|
## 작성자: happybell80
|
|
## 관련 서비스: robeing-gateway
|
|
## 상태: 해결 완료
|
|
|
|
---
|
|
|
|
## 1. 문제 발생
|
|
|
|
### Stats API URL 이중 슬래시
|
|
- **증상**: Gateway → Monitor 요청 시 `///api/stats//rb8001`
|
|
- **원인**: MONITOR_URL과 MONITOR_STATUS_URI 연결 시 슬래시 중복
|
|
- **위치**: `robeing-gateway/app/main.py:290`
|
|
|
|
### 헬스체크 실패
|
|
- **증상**: Actions에서 localhost:8100/healthz 연결 거부
|
|
- **원인**: 컨테이너 시작 지연
|
|
|
|
---
|
|
|
|
## 2. 해결 방법
|
|
|
|
### Stats API 수정
|
|
**서버 .env 수정**:
|
|
```bash
|
|
MONITOR_STATUS_URI=/api/stats # 앞 슬래시만 유지
|
|
```
|
|
|
|
### Redis 연결 설정
|
|
**서버 .env 추가**:
|
|
```bash
|
|
REDIS_HOST=auth-redis # auth-server의 Redis 컨테이너 공유
|
|
REDIS_PORT=6379
|
|
```
|
|
|
|
---
|
|
|
|
## 3. 아키텍처
|
|
|
|
### 캐시 구조
|
|
- **UserCache**: 사용자-로빙 매핑 (메모리, 30분 TTL)
|
|
- **Redis**: Rate limiting (auth-redis 컨테이너)
|
|
|
|
### 네트워크
|
|
- 모든 컨테이너가 appnet 네트워크 공유
|
|
- auth-redis:6379로 직접 통신 가능
|
|
|
|
---
|
|
|
|
## 4. 확인 방법
|
|
```bash
|
|
docker inspect robeing-gateway auth-redis | grep -A2 "Networks"
|
|
```
|
|
|
|
## 5. 결과
|
|
- ✅ Stats API 정상 작동
|
|
- ✅ Redis 연결 성공 (rate limiting)
|
|
- ✅ 헬스체크 통과
|
|
|
|
---
|
|
|
|
## 6. 현재 상태 (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 시 기본값 반환 중
|
|
- **상태**: 미해결 |