-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(android): document tombstone support #16301
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
Open
supervacuus
wants to merge
14
commits into
master
Choose a base branch
from
feat/android/tombstone_support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7891edb
feat(android): document tombstone support
supervacuus fecf847
Merge branch 'master' into feat/android/tombstone_support
supervacuus 6a36299
Merge branch 'master' into feat/android/tombstone_support
supervacuus d838aa2
Merge branch 'master' into feat/android/tombstone_support
supervacuus 58ca094
Update docs/platforms/android/configuration/tombstones.mdx
supervacuus e9f6e4c
Update docs/platforms/android/configuration/tombstones.mdx
supervacuus e396c6d
Update docs/platforms/android/configuration/tombstones.mdx
supervacuus 521eae3
Update docs/platforms/android/configuration/tombstones.mdx
supervacuus 399186a
Update docs/platforms/android/configuration/tombstones.mdx
supervacuus a6f25b7
Update docs/platforms/android/configuration/tombstones.mdx
supervacuus ee24b7b
Update docs/platforms/android/configuration/tombstones.mdx
supervacuus 4903ac3
Update docs/platforms/android/configuration/tombstones.mdx
supervacuus f123569
Merge branch 'master' into feat/android/tombstone_support
supervacuus 887f457
Merge branch 'master' into feat/android/tombstone_support
supervacuus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| --- | ||
| title: Android Native Crash Reporting (Tombstones) | ||
| sidebar_order: 2 | ||
| description: Learn how to configure Tombstone support. | ||
| --- | ||
|
|
||
| The Tombstone Integration generates events for native crashes based on data ("tombstones") that Android attaches to [`ApplicationExitInfo.REASON_CRASH_NATIVE`](https://developer.android.com/reference/android/app/ApplicationExitInfo#REASON_CRASH_NATIVE) starting with [Android 12+](https://developer.android.com/reference/android/app/ApplicationExitInfo#getTraceInputStream()). | ||
|
|
||
| This crash context is collected by the operating system during the app’s shutdown after a crash. Because part of this process runs out of process, it can capture richer crash details than the [NDK integration](/platforms/android/configuration/using-ndk/). | ||
|
|
||
| In particular, you will get: | ||
|
|
||
| * stack-traces for each of the threads in your process (which on Android is often key to understanding crashes) | ||
| * improved stack traces through Android Runtime stack frames | ||
| * client-side symbolication of all system libraries (while still allowing for server-side symbolication of your binaries to keep app size small) | ||
|
|
||
| The Tombstone Integration is disabled by default. You can enable the tombstone integration using: | ||
|
|
||
| ```xml {filename:AndroidManifest.xml} | ||
| <application> | ||
| <meta-data android:name="io.sentry.tombstone.enable" android:value="true" /> | ||
| </application> | ||
| ``` | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it'd be great if we include a screenshot (in light mode) showcasing the native stacktrace (can be taken from our sample app). To at least have some visual representations of this |
||
| #### Merging Tombstone and NDK Crash Events | ||
|
|
||
| It generally makes sense run the [NDK integration](/platforms/android/configuration/using-ndk/) (`io.sentry.ndk.enable`) and the Tombstone integration at the same time: | ||
|
|
||
| * if you have users on devices < Android 12 (in which case the NDK integration will solely be reporting native crashes) | ||
| * if you use functions of the Native SDK from your native code and want your collected context to be reflected in the crash reports | ||
|
|
||
| The reports from both integrations will be merged on the client into a single report, which will later be enriched. This means that whenever the Android version allows it, you will get improved crash reporting from tombstones; otherwise, the SDK falls back to the best-effort implementation from the NDK integration. In both cases, the Native SDK context is preserved in the final report. | ||
|
|
||
| #### Tombstone Mechanisms | ||
|
|
||
| We introduced two new mechanisms to help identify the integration from which reports originate: | ||
|
|
||
| * A report originating only from a tombstone will be called `Tombstone` | ||
| * A report being a merged result from a tombstone and a Native SDK event will be called `TombstoneMerged` | ||
| * A report originating solely from the NDK integration (Native SDK) will continue to be called `signalhandler` | ||
|
|
||
| #### Symbolication | ||
|
|
||
| As mentioned above, Android infrastructure will try to symbolicate as much as possible on the client side. This is particularly important for system and framework symbols, since they can differ considerably across devices. If symbols cannot be resolved on the client - for instance, for your supplied binaries - the [backend symbolication](/platforms/android/configuration/using-ndk/#symbolicate-stack-traces) process follows the same rules as with the NDK integration. | ||
|
|
||
| #### Debug Images | ||
|
|
||
| In contrast to NDK integration, Tombstones retrieve module memory mappings at the time of the crash and are thus always up-to-date. If you use the NDK integration as a fallback for older Android versions, you still need to clear the module cache when dynamically loading libraries after app initialization. | ||
|
|
||
| #### Historical Tombstones | ||
|
|
||
| By default, the SDK only reports and enriches the latest Tombstones. However, there's also a `setReportHistoricalTombstones` option available in `SentryOptions`, which enables the SDK to report all Tombstones from the [getHistoricalExitReasons](<https://developer.android.com/reference/android/app/ActivityManager?hl=en#getHistoricalProcessExitReasons(java.lang.String,%20int,%20int)>) list: | ||
|
|
||
| ```kotlin | ||
| SentryAndroid.init(context) { options -> | ||
| options.isReportHistoricalTombstones = true | ||
| } | ||
| ``` | ||
|
|
||
| ```java | ||
| SentryAndroid.init(context) { options -> | ||
| options.setReportHistoricalTombstones(true) | ||
| } | ||
| ``` | ||
|
|
||
| This option is useful after upgrading to an SDK version that introduces the Tombstone integration, as it allows you to report any tombstones that occurred before the update. | ||
|
|
||
| It can also make sense if you get recurring reports of native crashes early during app start, or if your app regularly runs and restarts during longer offline periods. | ||
|
|
||
| Other than that, the SDK will always pick up the latest Tombstone from the historical exit reasons list on the next app restart, and there won’t be any historical Tombstones to report. Also keep in mind that historical Tombstones will receive only minimal updates, as the available data is likely out of sync. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we maybe also have a small section on the NDK integration page about tombstones, referencing this page?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think it also makes sense to stress the point here: getsentry/sentry-java#3295 (comment) (aka Tombstones are not a replacement for the NDK integration) a bit more. Which also makes sense to do from both sides.