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

RUM-2878: Report fatal ANRs #1909

Merged

Conversation

0xnm
Copy link
Member

@0xnm 0xnm commented Mar 12, 2024

What does this PR do?

This PR adds support of reporting fatal ANRs (ANR which resulted in the Application Not Responding dialog where user decided to close the application).

This functionality relies on the ApplicationExitInfo API (available since Android API 30), which can be read on the next application run. So in that sense it is similar to the approach we have to report NDK crashes: on the next application run we need to run this information and match it with the last RUM view event we know.

Since we cannot mark a particular ApplicationExitInfo as read in the system, we have to store the timestamp of the last ApplicationExitInfo we processed to avoid the possible delivery on the next application run.

When processing ApplicationExitInfo, we will read trace information attached to it and try to parse it (it is non-structured log).

This PR doesn't add the possibility to disable reporting of non-fatal (or unknown) ANRs, and it doesn't add error.category info, this will be done in next PRs.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@0xnm 0xnm requested review from a team as code owners March 12, 2024 12:37
@0xnm 0xnm force-pushed the nogorodnikov/rum-2878/sdk-captures-and-reports-fatal-anrs branch from a295175 to b6f9e6c Compare March 12, 2024 12:57
@codecov-commenter
Copy link

codecov-commenter commented Mar 12, 2024

Codecov Report

Merging #1909 (5ffa623) into develop (f46eb76) will increase coverage by 0.05%.
Report is 6 commits behind head on develop.
The diff coverage is 85.33%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1909      +/-   ##
===========================================
+ Coverage    83.38%   83.43%   +0.05%     
===========================================
  Files          477      478       +1     
  Lines        16922    17124     +202     
  Branches      2514     2558      +44     
===========================================
+ Hits         14109    14286     +177     
- Misses        2120     2135      +15     
- Partials       693      703      +10     
Files Coverage Δ
.../kotlin/com/datadog/android/api/feature/Feature.kt 100.00% <ø> (ø)
...ain/kotlin/com/datadog/android/core/DatadogCore.kt 84.49% <100.00%> (+0.80%) ⬆️
...l/net/info/BroadcastReceiverNetworkInfoProvider.kt 93.88% <100.00%> (ø)
...e/internal/net/info/CallbackNetworkInfoProvider.kt 95.24% <100.00%> (ø)
...id/core/internal/system/BuildSdkVersionProvider.kt 100.00% <100.00%> (ø)
...dog/android/ndk/internal/DatadogNdkCrashHandler.kt 82.14% <100.00%> (+0.79%) ⬆️
...om/datadog/android/ndk/internal/NdkCrashHandler.kt 100.00% <ø> (ø)
...dog/android/ndk/internal/NdkCrashReportsFeature.kt 67.31% <100.00%> (ø)
...ndroid/rum/internal/DefaultAppStartTimeProvider.kt 100.00% <100.00%> (ø)
.../android/rum/internal/monitor/DatadogRumMonitor.kt 84.52% <100.00%> (ø)
... and 10 more

... and 17 files with indirect coverage changes

Copy link
Member

@xgouchet xgouchet left a comment

Choose a reason for hiding this comment

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

Nice job

@0xnm 0xnm force-pushed the nogorodnikov/rum-2878/sdk-captures-and-reports-fatal-anrs branch from b6f9e6c to c8b1fce Compare March 14, 2024 10:21
@0xnm 0xnm force-pushed the nogorodnikov/rum-2878/sdk-captures-and-reports-fatal-anrs branch from c8b1fce to 5ffa623 Compare March 14, 2024 13:47
@0xnm 0xnm merged commit d6cec44 into develop Mar 18, 2024
23 checks passed
@0xnm 0xnm deleted the nogorodnikov/rum-2878/sdk-captures-and-reports-fatal-anrs branch March 18, 2024 09:34
@xgouchet xgouchet added this to the 2.7.0 milestone Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants