Repository navigation
feat(metrics): 동시 접속자 게이지 active_users 추가 - #76
Merged
Merged
Conversation
websocket_sessions는 대전 방에 입장한 사람만 세고(프론트가 방 입장 때만
WebSocket을 연다), 솔로 시작 요청 수는 보드 재시작이 중복으로 잡혀 접속자
수로 쓸 수 없었다. 인증을 통과한 지점에서 userId별 마지막 활동 시각을
기록하고 "최근 1분/5분 안에 활동한 고유 사용자 수"를 게이지로 노출한다.
- ActiveUserTracker: 인메모리 Map<userId, lastSeen>, MeterBinder로
active_users{window="1m|5m"} 등록. 게이지 읽을 때 30분 넘은 항목 정리.
- JwtAuthenticationFilter: 인증 성공 시 touch — 인증된 모든 HTTP가 지나는 곳.
- StompAuthChannelInterceptor: CONNECT 이후 Principal이 붙은 모든 프레임에서
touch — 대전 중인 사람은 HTTP를 거의 안 보내서 필터만으로는 창에서 빠진다.
- 대시보드: "활성 사용자 (5분)" 타일, "접속자" 행(활성 사용자 1m/5m 추이,
솔로 시작/제출 2분 창). 솔로 시작은 201이라 status=~"2.."로 건다.
- 테스트: 창별 만료·중복 제거·게이지 노출, 필터·인터셉터의 기록 여부.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📍 PR 타입 (하나 이상 선택)
🏷️ 관련 이슈
Close #
📌 개요
active_users{window="1m|5m"}추가 — 최근 N분 안에 활동한 고유 사용자 수websocket_sessions는 대전 방에 입장한 사람만 센다 (프론트가 방 입장 때만 WebSocket을 연다)3이었지만 솔로 시작은 2분당 3058회였다🔁 변경 사항
ActiveUserTracker(신규,global/metrics): userId별 마지막 활동 시각을 인메모리 맵에 기록하고 MeterBinder로 게이지 등록. 게이지를 읽을 때(15초마다) 30분 넘게 조용한 항목을 정리한다 — 스케줄러 없음JwtAuthenticationFilter: 인증 성공 직후touch(userId)— 인증된 모든 HTTP가 지나는 자리라 컨트롤러마다 심지 않아도 된다StompAuthChannelInterceptor: CONNECT 이후 Principal이 붙은 모든 프레임에서touch— 대전 중인 사람은 HTTP를 거의 안 보내서 필터만으로는 5분 창에서 빠진다applegame-load.jsonstatus=~"2.."로 건다 (200만 세면 0이 나온다)docs/INFRA.mdPhase 3에 10-23 2차로 기록📸 스크린샷
머지·배포 후 "활성 사용자 (5분)" 타일과 "접속자" 행 확인 예정
✅ 체크리스트
ActiveUserTrackerTest5건(중복 제거, 1m/5m 창 독립 만료, 재활동 복귀, null 무시, 게이지 노출),JwtAuthenticationFilterTest+1,StompAuthChannelInterceptorTest+1docs/INFRA.md💡 추가 사항 (리뷰어가 참고해야 할 것)
git pull→ Grafana가 30초 안에 대시보드 파일을 다시 읽는다 (updateIntervalSeconds: 30)🤖 Generated with Claude Code