[add] 엠플리튜드 유저id 세팅 + 파이어베이스 크래시 에널리틱스 추가 #454
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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 |
49fa205 to
5b43ece
Compare
hyeyeonie
left a comment
There was a problem hiding this comment.
애널리틱스 추가 작업하신 거 확인했습니다 ~ !
파일 상단에 설명 기재해주신 것 같은데 코드 작업할 때 참고하겠습니다 👍🏻
|
|
||
| import UIKit | ||
| import FirebaseCore | ||
| import FirebaseCrashlytics |
| // MARK: - Crash Reporting | ||
|
|
||
| private static func report(_ error: NetworkError, path: String) { | ||
| let code: Int | ||
| switch error { | ||
| case .serverError(let serverError): code = serverError.code | ||
| case .decoding: code = -1001 | ||
| case .networkFail: code = -1002 | ||
| case .timeout: code = -1003 | ||
| case .forbidden: code = 403 | ||
| case .unauthorized: code = 401 | ||
| case .notFound: code = 404 | ||
| case .refreshFailed: code = -1004 | ||
| case .unknown: code = -1000 | ||
| } |
5b43ece to
a7fb11c
Compare
✅ Check List
📌 Related Issue
📎 Work Description
분석/관측(Analytics & Observability) 파이프라인을 Android와 동일한 수준으로 맞췄습니다.
userId(Long)를 Amplitudeuser_id로 연결1. Amplitude userId 매핑
서버가 소셜로그인 / 회원가입 프로필 등록 / 내정보 확인 응답에
userId(Long)를 추가함에 따라, 이를 Amplitude user_id로 설정합니다.세팅 지점 (코호트별)
userIdLoginViewModeluserIdOnBoardingViewModeluserIdMypageViewModelclearUserId()는 로그아웃용으로 제공)minIdLength = 1— Amplitude 기본 규칙(user_id ≥ 5자)에 막혀 짧은 숫자 id가 400(Invalid id length)으로 거부되던 문제 해결.데이터 흐름 변경
UserProfileResponseDTO/UserProfileEntity/mapper에userId: Int64?추가 (mypage/info)LoginResponseDTO/LoginResponseEntity/mapper에userId: Int64?추가 (소셜 로그인)RegisterProfileResponseDTO신규 + OnBoarding 체인(Service/Repository/UseCase)Void → Int64(가입 시requestPlain→request로 응답 수신)TokenRefreshResponseDTO는 userId 없음 → 미적용AmplitudeManager.updateUserId(Int64)/clearUserId()추가2. 에러 CTA Amplitude 이벤트
에러 화면의 CTA 버튼 클릭을 수집합니다. 버튼을 실제로 탭했을 때만 발화(화면 노출 시점엔 미발화).
server_error_retrynetwork_error_retrydata_not_found_go_backserver_error_go_back/ 데이터없음data_not_found_go_backserver_error_confirmfeedback_retry3. Firebase Crashlytics + Analytics 연동
크래시·오류 모니터링을 추가하고 Slack으로 알림이 가도록 연동했습니다.
수집 정책
FirebaseApp.configure()로 양쪽 빌드 자동 수집.BaseServicechoke-point에서 모든 실패를 기록(에러 코드 필터 없음 — AndroidTimber.e → ReleaseTree.recordException와 동일). RELEASE 빌드에서만 전송(한 Firebase 프로젝트 + 프로젝트 단위 Slack이라 dev 노이즈 방지).50302(GPT)·50304(S3) 등 세부 코드로 그룹핑.구조 (모듈 경계 유지)
CrashReporting프로토콜 +CrashReporter(HilingualCore, Firebase 비의존) — Network/Presentation은 추상화만 호출FirebaseCrashReporter(App 타겟) — Crashlytics 구현체를#if !DEBUG에서 주입BaseService.report(...)— non-fatal을NSError(domain: "API.<API>", code:, userInfo: [path, error])로 기록 → 도메인/코드별 그룹핑📷 Screenshots
💬 To Reviewers