Skip to content

feat: 행동 로그 Amplitude 전송 연동#255

Merged
Junhyukkkk merged 1 commit into
developfrom
feature/amplitude-analytics-forwarding
Jun 25, 2026
Merged

feat: 행동 로그 Amplitude 전송 연동#255
Junhyukkkk merged 1 commit into
developfrom
feature/amplitude-analytics-forwarding

Conversation

@Junhyukkkk

@Junhyukkkk Junhyukkkk commented Jun 25, 2026

Copy link
Copy Markdown
Member

📌 관련 이슈

  • closes #

🔍 작업 내용

실제 서비스 사용자의 클릭/이벤트 통계를 PM·디자이너가 대시보드에서 볼 수 있도록,
행동 로그를 Amplitude로도 전송하는 연동을 추가했습니다. (광고 집행 전 분석 툴 사전 설치 요청 대응)

기존 행동 로그 인프라(analytics.log() → RDB 적재 + GA4 전송)에 목적지 하나(Amplitude)를
fan-out으로 추가한 구조라, 이벤트를 심는 호출부 코드는 전혀 바뀌지 않습니다.

📝 변경 사항

  • AmplitudeProperties / AmplitudeClient 추가 — GA4 클라이언트와 동일한 패턴
    (@Async("analyticsExecutor") fire-and-forget, 미설정 시 no-op, 예외 전부 흡수)
  • AnalyticsEventLogger에서 amplitude.send(...) 한 줄 fan-out 추가
  • application.ymlamplitude.* 설정 블록 추가
  • 배포 환경변수 배선: release.yml(env/envs), scripts/deploy.sh(-e) 에 AMPLITUDE_* 추가
  • AmplitudeClientTest 단위 테스트 추가 (페이로드 변환 규칙 검증)

⚙️ 배포 전 필요 작업 (코드 외)

  • GitHub repo Secrets 등록 필요:
    • AMPLITUDE_API_KEY = Amplitude 프로젝트 API Key
    • AMPLITUDE_ENABLED = true
  • 미등록 시 앱은 no-op으로 동작하며 RDB 적재·GA4 전송에는 영향 없음

💬 리뷰어에게

  • Amplitude는 user_id/device_id 최소 5자 제약이 있어, GA4와 동일하게 user_id를 uid.{id}로 보냅니다.
  • 비회원이고 anonymous_id 쿠키도 없는 경우 이벤트 거부를 막기 위해 랜덤 device_id를 생성합니다.

Summary by CodeRabbit

  • New Features

    • Amplitude 분석 설정이 배포 환경에 추가되었습니다.
    • AMPLITUDE_API_KEY가 설정된 경우에만 관련 추적 옵션이 활성화되며, 필요한 환경값이 자동으로 전달됩니다.
  • Bug Fixes

    • 원격 배포 시 일부 분석 설정이 누락되던 문제를 개선했습니다.

기존 analytics.log() 단일 진입점에서 RDB 적재·GA4 전송에 더해
Amplitude HTTP V2 API로도 fire-and-forget 전송하도록 추가.
미설정 시 no-op이며, 배포 환경변수(AMPLITUDE_ENABLED/API_KEY) 배선 포함.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Junhyukkkk Junhyukkkk self-assigned this Jun 25, 2026
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 95dca355-3f13-4746-9e4f-4eae382d72ba

📥 Commits

Reviewing files that changed from the base of the PR and between 2ab8e1a and 3b5699e.

📒 Files selected for processing (2)
  • .github/workflows/release.yml
  • scripts/deploy.sh

Walkthrough

배포 워크플로가 Amplitude 시크릿을 원격 실행 환경으로 전달하도록 바뀌었고, 원격 배포 스크립트는 AMPLITUDE_API_KEY가 있을 때만 Amplitude HTTP V2 환경 변수를 DOCKER_OPTS에 추가합니다.

Changes

Amplitude 배포 환경 전달

Layer / File(s) Summary
SSH 배포 환경 전달
.github/workflows/release.yml
appleboy/ssh-action 실행 환경에 AMPLITUDE_ENABLEDAMPLITUDE_API_KEY를 추가하고, 원격 전달 변수 목록에 Amplitude 항목을 포함함.
원격 Amplitude 설정
scripts/deploy.sh
AMPLITUDE_API_KEY가 있을 때만 Amplitude HTTP V2 환경 변수를 DOCKER_OPTS에 추가하고 관련 로그를 출력함.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 깡총깡총 배포 길
비밀 키가 바람 타고 휙~
Amplitude도 조용히 탑승
토끼는 로그를 콩콩 확인
DOCKER_OPTS에 살짝 얹고
서버는 오늘도 씩씩하게!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/amplitude-analytics-forwarding

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Junhyukkkk Junhyukkkk merged commit 86800c4 into develop Jun 25, 2026
3 of 4 checks passed
@Junhyukkkk Junhyukkkk deleted the feature/amplitude-analytics-forwarding branch June 25, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant