feat: 몰입형 투표 startVoteId 지원 및 Amplitude 행동 로그 연동#253
Merged
Conversation
POST /api/immersive-votes/next 요청에 startVoteId를 보내면 진행 중인 해당 투표를 피드 맨 앞에 배치하고 나머지를 랜덤으로 채운다. 종료/없는 투표거나 excludeIds에 포함된 경우 무시하고 기존 랜덤 동작.
RDB 적재와 별개로 Amplitude HTTP V2 API로도 이벤트를 전송한다. amplitude.enabled=true + API Key가 있을 때만 동작하며, 없으면 no-op.
|
Caution Review failedPull request was closed or merged during review WalkthroughAmplitude HTTP V2 이벤트 전송을 위한 ChangesAmplitude HTTP V2 이벤트 전송 연동
ImmersiveVote getNextRandom startVoteId 우선 배치
Sequence Diagram(s)sequenceDiagram
participant Client as 클라이언트
participant Controller as ImmersiveVoteController
participant Service as ImmersiveVoteQueryService
participant Repo as VoteRepository
Client->>Controller: GET /next-random (excludeIds, startVoteId, size)
Controller->>Service: getNextRandom(excludeIds, startVoteId, size, userId, anonymousId)
alt startVoteId 유효 (진행 중 & excludeIds에 없음)
Service->>Repo: findById(startVoteId)
Repo-->>Service: Vote
Service->>Repo: findRandomExcluding(now, exclude+startVoteId, size-1)
Repo-->>Service: 랜덤 투표 목록
Service-->>Controller: [startVote, ...randomVotes]
else startVoteId 없거나 무효
Service->>Repo: findRandom / findRandomExcluding(now, excludeIds, size)
Repo-->>Service: 랜덤 투표 목록
Service-->>Controller: [...randomVotes]
end
Controller-->>Client: ImmersiveNextResult
sequenceDiagram
participant Logger as AnalyticsEventLogger
participant GA4 as GA4Client
participant Amplitude as AmplitudeClient
participant API as Amplitude HTTP V2
Logger->>GA4: send(event)
Logger->>Amplitude: send(eventName, userId, anonymousId, member, platform, props)
Note over Amplitude: `@Async`("analyticsExecutor") — 비동기
Amplitude->>Amplitude: isConfigured() 확인
Amplitude->>API: POST /2/httpapi (JSON payload)
API-->>Amplitude: 응답 (예외 시 warn 로그)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
빌드 성공 |
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.
📌 관련 이슈
🔍 작업 내용
몰입형 투표 피드에서 특정 투표로 바로 이동할 수 있도록
POST /api/immersive-votes/next에startVoteId를 추가하고, 행동 로그를 Amplitude 대시보드로도 전송하는 연동을 추가했습니다.📝 변경 사항
몰입형 투표 startVoteId 지원
ImmersiveNextRequest에startVoteId필드 추가startVoteId지정 시 진행 중인 해당 투표를 피드 맨 앞에 배치하고 나머지를 랜덤으로 채움excludeIds에 이미 포함된 경우 무시하고 기존 랜덤 동작 유지Amplitude 애널리틱스 연동
amplitude.enabled=true+ API Key가 있을 때만 동작하며, 없으면 no-op (RDB 적재는 그대로)AmplitudeClient,AmplitudeProperties추가 및application.yml설정 추가💬 리뷰어에게
startVoteId는 보통 첫 요청에만 전달되며, 이후 순환 요청에서는excludeIds에 쌓여 자동으로 무시됩니다. 무한 순환 동작에는 영향이 없습니다.enabled=false) 상태이며, 환경변수(AMPLITUDE_ENABLED,AMPLITUDE_API_KEY) 설정 시에만 실제 전송됩니다.Summary by CodeRabbit
New Features
Bug Fixes