Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add collection of ANRs to Crashlytics #2756

Merged
merged 21 commits into from
Jun 24, 2021
Merged

Add collection of ANRs to Crashlytics #2756

merged 21 commits into from
Jun 24, 2021

Conversation

tejasd
Copy link
Contributor

@tejasd tejasd commented Jun 23, 2021

  • The feature is behind a settings experiment and should be a no-op if the experiment is not enabled.
  • It uses an API 30 feature getHistoricalProcessExitReasons to collect ANR data

@google-cla google-cla bot added the cla: yes Override cla label Jun 23, 2021
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jun 23, 2021

Coverage Report

Affected SDKs

  • firebase-crashlytics

    SDK overall coverage changed from 0.00% (91681dd) to 10.18% (133e2b76) by +10.18%.

    Click to show coverage changes in 23 files.
    Filename Base (91681dd) Head (133e2b76) Diff
    AppData.java 0.00% 56.25% +56.25%
    AutoCrashlyticsReportEncoder.java 0.00% 57.86% +57.86%
    AutoValue_CrashlyticsReport_ApplicationExitInfo.java ? 68.09% ?
    CLSUUID.java 0.00% 77.55% +77.55%
    CommonUtils.java 0.00% 7.55% +7.55%
    CrashlyticsBackgroundWorker.java 0.00% 56.25% +56.25%
    CrashlyticsController.java 0.00% 14.63% +14.63%
    CrashlyticsFileMarker.java 0.00% 30.77% +30.77%
    CrashlyticsReport.java 0.00% 2.83% +2.83%
    CrashlyticsReportDataCapture.java 0.00% 3.94% +3.94%
    CrashlyticsReportJsonTransform.java 0.00% 1.24% +1.24%
    CrashlyticsReportPersistence.java 0.00% 2.44% +2.44%
    DataTransportCrashlyticsReportSender.java 0.00% 38.89% +38.89%
    FeaturesSettingsData.java 0.00% 100.00% +100.00%
    IdManager.java 0.00% 3.13% +3.13%
    KeysMap.java 0.00% 36.84% +36.84%
    LogFileManager.java 0.00% 43.48% +43.48%
    Logger.java 0.00% 54.05% +54.05%
    MetaDataStore.java 0.00% 13.24% +13.24%
    ProviderProxyNativeComponent.java 0.00% 16.28% +16.28%
    QueueFileLogStore.java 0.00% 7.58% +7.58%
    SessionReportingCoordinator.java 0.00% 43.38% +43.38%
    UserMetadata.java 0.00% 40.00% +40.00%
  • firebase-database

    SDK overall coverage changed from 50.00% (91681dd) to 50.04% (133e2b76) by +0.04%.

    Filename Base (91681dd) Head (133e2b76) Diff
    BooleanNode.java 100.00% 92.31% -7.69%
    ChildChangeAccumulator.java 83.33% 96.67% +13.33%
    ViewProcessor.java 91.79% 92.10% +0.30%
  • firebase-firestore

    SDK overall coverage changed from 47.15% (91681dd) to 47.23% (133e2b76) by +0.09%.

    Filename Base (91681dd) Head (133e2b76) Diff
    AsyncQueue.java 77.89% 78.39% +0.50%
    FirestoreClient.java 30.08% 34.96% +4.88%
    LruGarbageCollector.java 84.11% 93.46% +9.35%
  • firebase-storage

    SDK overall coverage changed from ? (91681dd) to 85.81% (133e2b76) by ?.

    Click to show coverage changes in 46 files.
    Filename Base (91681dd) Head (133e2b76) Diff
    ActivityLifecycleListener.java ? 74.14% ?
    AdaptiveStreamBuffer.java ? 84.62% ?
    CancelException.java ? 100.00% ?
    CancellableTask.java ? 100.00% ?
    ControllableTask.java ? 100.00% ?
    DeleteNetworkRequest.java ? 100.00% ?
    DeleteStorageTask.java ? 100.00% ?
    ExponentialBackoffSender.java ? 86.00% ?
    FileDownloadTask.java ? 80.00% ?
    FirebaseStorage.java ? 85.11% ?
    FirebaseStorageComponent.java ? 100.00% ?
    GetDownloadUrlTask.java ? 96.77% ?
    GetMetadataNetworkRequest.java ? 100.00% ?
    GetMetadataTask.java ? 85.19% ?
    GetNetworkRequest.java ? 100.00% ?
    HttpURLConnectionFactory.java ? 0.00% ?
    HttpURLConnectionFactoryImpl.java ? 50.00% ?
    ListNetworkRequest.java ? 100.00% ?
    ListResult.java ? 100.00% ?
    ListTask.java ? 85.71% ?
    NetworkRequest.java ? 86.67% ?
    OnPausedListener.java ? 0.00% ?
    OnProgressListener.java ? 0.00% ?
    ResumableNetworkRequest.java ? 100.00% ?
    ResumableUploadByteRequest.java ? 90.91% ?
    ResumableUploadCancelRequest.java ? 100.00% ?
    ResumableUploadQueryRequest.java ? 100.00% ?
    ResumableUploadStartRequest.java ? 95.24% ?
    Slashes.java ? 88.24% ?
    Sleeper.java ? 0.00% ?
    SleeperImpl.java ? 33.33% ?
    SmartHandler.java ? 87.50% ?
    StorageException.java ? 65.45% ?
    StorageMetadata.java ? 86.34% ?
    StorageReference.java ? 89.94% ?
    StorageReferenceUri.java ? 100.00% ?
    StorageRegistrar.java ? 100.00% ?
    StorageTask.java ? 84.29% ?
    StorageTaskManager.java ? 100.00% ?
    StorageTaskScheduler.java ? 100.00% ?
    StreamDownloadTask.java ? 88.89% ?
    TaskListenerImpl.java ? 100.00% ?
    UpdateMetadataNetworkRequest.java ? 100.00% ?
    UpdateMetadataTask.java ? 82.14% ?
    UploadTask.java ? 80.22% ?
    Util.java ? 73.24% ?

Test Logs

Notes

HTML coverage reports can be produced locally with ./gradlew <product>:checkCoverage.
Report files are located at <product-build-dir>/reports/jacoco/.

Head commit (133e2b76) is created by Prow via merging commits: 91681dd 3ebad98.

@tejasd tejasd requested a review from mrichards June 23, 2021 17:50
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jun 23, 2021

Binary Size Report

Affected SDKs

  • firebase-crashlytics

    Type Base (91681dd) Head (133e2b76) Diff
    aar 320 kB 330 kB +10.2 kB (+3.2%)
    apk (aggressive) 194 kB 197 kB +3.54 kB (+1.8%)
    apk (release) 822 kB 825 kB +3.50 kB (+0.4%)
  • firebase-crashlytics-ktx

    Type Base (91681dd) Head (133e2b76) Diff
    apk (aggressive) 210 kB 213 kB +3.39 kB (+1.6%)
    apk (release) 1.30 MB 1.31 MB +4.54 kB (+0.3%)
  • firebase-crashlytics-ndk

    Type Base (91681dd) Head (133e2b76) Diff
    apk (release) 5.11 MB 5.11 MB +4.10 kB (+0.1%)

Test Logs

Notes

Head commit (133e2b76) is created by Prow via merging commits: 91681dd 3ebad98.

@@ -74,7 +78,8 @@ dependencies {
annotationProcessor 'com.google.auto.value:auto-value:1.6.5'

testImplementation 'androidx.test:runner:1.3.0'
testImplementation "org.robolectric:robolectric:$robolectricVersion"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider updating $robolectricVersion

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deferred.

@@ -47,6 +47,12 @@ public String eventToJson(@NonNull CrashlyticsReport.Session.Event event) {
return CRASHLYTICS_REPORT_JSON_ENCODER.encode(event);
}

@NonNull
public String appExitInfoToJson(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to applicationExitInfoToJson

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

ActivityManager activityManager =
(ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<ApplicationExitInfo> applicationExitInfoList =
activityManager.getHistoricalProcessExitReasons(null, 0, 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change maxEvents to 1, and add a TODO to change this later if start linking ApplicationExitInfo to other events.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

UserMetadata userMetadataForSession) {
long sessionStartTime = reportPersistence.getStartTimestampMillis(sessionId);
// ApplicationExitInfo did not occur during the session.
if (applicationExitInfo.getTimestamp() < sessionStartTime) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might cause a bug where an ANR is sent repeatedly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not cause a bug.


/** If an ApplicationExitInfo exists relevant to the session, writes that event. */
private void writeApplicationExitInfoEventIfRelevant(String sessionId) {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add log when it's not API 30

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jun 24, 2021

@tejasd: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
device-check-changed 3ebad98 link /test device-check-changed

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Contributor

@mrichards mrichards left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had some Qs answered in synchronous code review with Tejas and Vivian. LGTM!!

@google-oss-bot
Copy link
Contributor

Macrobenchmark Report

Affected SDKs

Measurements are for head commit (3ebad98). Diffing against base commit (91681dd) is working in progress.

  • baseline

    NameDeviceMinMaxP50P90P99
    BenchmarkTest.startup[mode=COLD]flame-30-en-portrait127.0 ms154.0 ms135.0 ms147.3 ms153.2 ms
    BenchmarkTest.startup[mode=HOT]flame-30-en-portrait35.0 ms74.0 ms56.5 ms61.1 ms71.7 ms
    BenchmarkTest.startup[mode=WARM]flame-30-en-portrait53.0 ms95.0 ms74.5 ms86.3 ms93.9 ms
  • firebase-common

    NameDeviceMinMaxP50P90P99
    BenchmarkTest.startup[mode=COLD]flame-30-en-portrait113.0 ms149.0 ms136.5 ms148.0 ms148.8 ms
    BenchmarkTest.startup[mode=HOT]flame-30-en-portrait29.0 ms64.0 ms47.0 ms57.2 ms63.1 ms
    BenchmarkTest.startup[mode=WARM]flame-30-en-portrait44.0 ms86.0 ms70.5 ms82.1 ms85.4 ms
  • firebase-config

    NameDeviceMinMaxP50P90P99
    BenchmarkTest.startup[mode=COLD]flame-30-en-portrait130.0 ms167.0 ms147.0 ms162.3 ms166.6 ms
    BenchmarkTest.startup[mode=HOT]flame-30-en-portrait38.0 ms67.0 ms51.0 ms60.1 ms65.9 ms
    BenchmarkTest.startup[mode=WARM]flame-30-en-portrait53.0 ms88.0 ms72.0 ms85.1 ms87.6 ms
  • firebase-crashlytics

    NameDeviceMinMaxP50P90P99
    BenchmarkTest.startup[mode=COLD]flame-30-en-portrait148.0 ms182.0 ms162.5 ms169.4 ms180.3 ms
    BenchmarkTest.startup[mode=HOT]flame-30-en-portrait38.0 ms69.0 ms53.5 ms61.1 ms67.7 ms
    BenchmarkTest.startup[mode=WARM]flame-30-en-portrait60.0 ms95.0 ms75.0 ms86.0 ms95.0 ms
  • firebase-database

    NameDeviceMinMaxP50P90P99
    BenchmarkTest.startup[mode=COLD]flame-30-en-portrait118.0 ms149.0 ms133.0 ms143.3 ms148.4 ms
    BenchmarkTest.startup[mode=HOT]flame-30-en-portrait37.0 ms66.0 ms47.0 ms62.2 ms65.6 ms
    BenchmarkTest.startup[mode=WARM]flame-30-en-portrait50.0 ms83.0 ms69.0 ms82.1 ms83.0 ms
  • firebase-dynamic-links

    NameDeviceMinMaxP50P90P99
    BenchmarkTest.startup[mode=COLD]flame-30-en-portrait133.0 ms172.0 ms145.0 ms157.1 ms171.0 ms
    BenchmarkTest.startup[mode=HOT]flame-30-en-portrait35.0 ms72.0 ms57.5 ms63.6 ms71.4 ms
    BenchmarkTest.startup[mode=WARM]flame-30-en-portrait52.0 ms95.0 ms72.0 ms86.4 ms94.0 ms
  • firebase-firestore

    NameDeviceMinMaxP50P90P99
    BenchmarkTest.startup[mode=COLD]flame-30-en-portrait123.0 ms163.0 ms139.5 ms151.0 ms160.7 ms
    BenchmarkTest.startup[mode=HOT]flame-30-en-portrait44.0 ms66.0 ms51.0 ms57.7 ms65.6 ms
    BenchmarkTest.startup[mode=WARM]flame-30-en-portrait52.0 ms90.0 ms71.0 ms85.3 ms89.6 ms
  • firebase-functions

    NameDeviceMinMaxP50P90P99
    BenchmarkTest.startup[mode=COLD]flame-30-en-portrait133.0 ms152.0 ms148.0 ms151.1 ms152.0 ms
    BenchmarkTest.startup[mode=HOT]flame-30-en-portrait41.0 ms64.0 ms56.0 ms61.1 ms63.6 ms
    BenchmarkTest.startup[mode=WARM]flame-30-en-portrait58.0 ms83.0 ms66.0 ms80.1 ms82.6 ms
  • firebase-inappmessaging-display

    NameDeviceMinMaxP50P90P99
    BenchmarkTest.startup[mode=COLD]flame-30-en-portrait172.0 ms199.0 ms183.0 ms196.1 ms198.6 ms
    BenchmarkTest.startup[mode=HOT]flame-30-en-portrait40.0 ms77.0 ms57.5 ms65.1 ms74.9 ms
    BenchmarkTest.startup[mode=WARM]flame-30-en-portrait59.0 ms99.0 ms78.0 ms97.0 ms98.6 ms
  • firebase-messaging

    NameDeviceMinMaxP50P90P99
    BenchmarkTest.startup[mode=COLD]flame-30-en-portrait133.0 ms161.0 ms148.0 ms159.2 ms161.0 ms
    BenchmarkTest.startup[mode=HOT]flame-30-en-portrait44.0 ms66.0 ms53.5 ms61.2 ms65.4 ms
    BenchmarkTest.startup[mode=WARM]flame-30-en-portrait66.0 ms87.0 ms73.5 ms84.1 ms86.6 ms
  • firebase-perf

    NameDeviceMinMaxP50P90P99
    BenchmarkTest.startup[mode=COLD]flame-30-en-portrait143.0 ms174.0 ms159.5 ms172.2 ms174.0 ms
    BenchmarkTest.startup[mode=HOT]flame-30-en-portrait27.0 ms66.0 ms54.0 ms64.0 ms65.6 ms
    BenchmarkTest.startup[mode=WARM]flame-30-en-portrait61.0 ms103.0 ms80.5 ms96.3 ms102.2 ms
  • firebase-storage

    NameDeviceMinMaxP50P90P99
    BenchmarkTest.startup[mode=COLD]flame-30-en-portrait128.0 ms173.0 ms142.5 ms171.1 ms172.8 ms
    BenchmarkTest.startup[mode=HOT]flame-30-en-portrait39.0 ms73.0 ms55.0 ms64.7 ms72.6 ms
    BenchmarkTest.startup[mode=WARM]flame-30-en-portrait59.0 ms98.0 ms73.5 ms86.6 ms96.9 ms

@tejasd tejasd merged commit 011b65b into master Jun 24, 2021
@tejasd tejasd deleted the crashlytics/anrs branch June 24, 2021 21:26
@firebase firebase locked and limited conversation to collaborators Jul 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants