brunch

You can make anything
by writing

C.S.Lewis

by 이승현 Aug 03. 2016

Firebase #05

Crash Reporting

Firebase Crash Reporting


Comprehensive and actionable information to help diagnose and fix problems in your app.

(포괄적이고 실행 가능한 정보는 앱의 문제를 진단하고 해결하는데 도움이 됩니다.)


Crash Reporting creates detailed reports of the errors in your app.

(Crash Reporting은 앱 오류의 자세한 보고서를 생성합니다.)


Errors are grouped into clusters of similar stack traces and triaged by the severity of impact on your users.

(오류들은 비슷한 스택 추적의 클러스트로 그룹화되고 사용자에게 미치는 영향의 정도에 의해 분류된다.)


In addition to automatic reports, you can log custom events to help capture the steps leading up to a crash.

(자동 보고서 이외에, 충돌에 이르기까지의 과정을 캡처할 수 있도록 사용자 정의 이벤트들을 기록할 수 있다.)


Crash Reporting is currently in beta release while we resolve some known issues on Android and iOS.

(Crash Reporting은 현재 잘 알려진 Android와 iOS 이슈를 해결하고 있는 beta 버전이다.)


https://firebase.google.com/docs/crash/

https://www.youtube.com/watch?list=PLl-K7zZEsYLmOF_07IayrTntevxtbUxDL&time_continue=2&v=B7mlLVAkcfU




Key functions

Monitor fatal and non-fatal errors
iOS의 치명적인 오류와 Android의 치명적이고 비치명적인 오류들을 관찰합니다. 보고서는 사용자에 미치는 영향의 정도에 의해 우선 순위에 따라 분류됩니다.

Collect the data you need to diagnose problems
오류가 발생한 경우 보고서는 기기 특성, 성능 데이터, 사용자의 상황뿐만 아니라 전체 stack 기록을 담고 있습니다. 관련되 버그들을 쉽게 식별할 수 있도록 유사한 보고서들이 자동으로 클러스트됩니다.

Integrate with Analytics
포착된 오류들은 Analytics에서 app_exception 이벤트로 설정되고, 오류를 볼 수있는 사람들을 기반으로 잠재 고객을 필터링 할 수 있도록 해줍니다. 

Free and easy
Crash Reporting은 무료입니다. 앱에 Firebase를 한번 추가하면, 단지 몇 라인의 코드로 포괄적인 오류 보고를 이용할 수 있습니다.


End user privacy

Firebase Crash Reporting은 스스로 어떠한 개인 식별 가능한 정보(이름, 이메일 주소, 전화번호)를 수집하지 않습니다.

개발자는 로그 및 예외 메시지와 함께 Crash Reporting을 사용하여 추가 데이터를 수집 할 수 있습니다

Crash Reporting을 통해 모인 정보는 개인적으로 구글에 개인을 식별하는 정보를 포함 할 수 없습니다.

문제를 진단하기 위해 사용자를 식별이 필요하다면,  구글 익명으로 보낼 데이터를 렌더링하는 데 적절한 난독 조치를 사용해야합니다.




Report Crashe 시작



https://firebase.google.com/docs/crash/android

https://firebase.google.com/docs/reference/android/com/google/firebase/crash/package-summary



1. google-service.json 추가

#01 구성 파일 복사

Android studio에서 프로젝트 보기로 전환하여 프로젝트 루트 디렉터리를 표시하세요.

다운로드한 google-service.json 파일을 Android 앱 모듈 루트 디렉터리로 이동하세요.


2. plugin 추가

#02 Project build.gradle에 추가
buildscript {
    ...
    dependencies {
        ...
        classpath 'com.google.gms:google-services:3.0.0'
    }
}
#03 app build.gradle에 추가
apply plugin: 'com.android.application'

...

dependencies {
    ...
    compile 'com.google.firebase:firebase-crash:9.2.1'
}

apply plugin: 'com.google.gms.google-services'


3. Create your first error


Firebase Crash Reporting는 자동적으로 치명적인 오류들(또는 uncaught 오류들)을 위해 보고서를 생성합니다.

그러나 exception을 포착해 보고하기 원하는 인스턴스에서 보고서들을 생성할 수 있습니다.

Crash Reporting console에 보여지기 까지 20분 정도 소요됩니다.

FirebaseCrash.report(new Exception("My first Android non-fatal error"));
#01 Firebase console Crash


4. Create custom logs


오류 보고서 및 선택적으로 logcat에서 사용자 제작 이벤트들을 기록하기 위해 Crash Reporting을 이용할 수 있습니다.

이벤트를 기록하기 원하고 logcat 출력물을 원하지 않는다면, string을 매개변수로 아래와 같이 전달해야 합니다.

logcat 출력물을 생성하기 원한다면, log 레벨과 태그를 반드시 제공해야 합니다.

FirebaseCrash.log("Activity created");
FirebaseCrash.logcat(Log.ERROR, TAG, "Logcat error");
#01 Logcat



Known issues


1. Multiple processes


Crash Reporting는 crash 정보를 업로드하기 위한 별도의 백그라운드 프로세스를 생성합니다.

앱이 Android Application 클래스를 확장하는 경우라면, multi-process 안정성을 반드시 확인해야 합니다.

그렇지 않으면 concurrency 문제를 일으킬 수 있습니다.

앱이 Application 객체를 확장하는 경우, 이 객체는 multi-proccess 앱에서 각각의 프로세스로 인스턴스화 됩니다.

이 객체의 구현이 out-of-process 상태(데이터베이스, 파일 시스템, shared preference, etc)를 접근하거나, multi-process 환경에 대한 안전하지 않은 다른 작업을 수행하는 경우, 동시성 이슈가 일어날 수 있습니다.

Application 객체의 여러 인스턴스를 동시에 실행할 수 있기 때문입니다.

많은 third-party 라이브러리들은 out-of-process 상태(로컬 데이터베이스)를 유지하고 Application 객체로부터 초기화 된다면 동시성 문제가 될 수 있습니다.

이 같은 경우에 Application 로직을 Content Providers나 Android Activities로 옮기길 강력히 추천합니다.


2. Analytics app_exception events


Crash Reporting는 자동적으로 포착한 문제들을 Firebase Analytics의 app_exception 이벤트로 내보냅니다.

현재 안드로이드에서 Crash Reporting 문제 개수와 Analytics app_exception 이벤트 개수의 상당한 차이를 볼 수 있을 것입니다.

실제로 찾아보니 app_exceptiond 이벤트는 보이지 않았습니다.

#01 Analytics



Firebase Console - Crash


#01 Crash

앱 버전, 모든 오류(심각한 오류, 심각하지 않은 오류)로 필터링이 가능합니다.

대시보드와 매핑파일 메뉴가 있는데 proguard시 난독화된 오류 정보는 매핑 파일 등록시 분석이 가능합니다.


#02 클러스트




Sample


https://github.com/oemilk/firebase






작가의 이전글 Firebase #04
작품 선택
키워드 선택 0 / 3 0
댓글여부
afliean
브런치는 최신 브라우저에 최적화 되어있습니다. IE chrome safari