Info
- Crashes, logged errors and bug reports go through the Sentry SDK to the app's crash reports on ServiceHub (GlitchTip)
- Code in
ServiceHub/CrashReporting (assembly Polis.Core.ServiceHub.CrashReporting, compiles only with the io.sentry.unity package, define SENTRY) and ServiceHub/CrashReports (CrashReportsApi)
- Needs the Crash reports service turned on for the app, see App Settings. Endpoints: API
Setup
- Package
io.sentry.unity (git URL https://github.com/getsentry/unity.git#<version>) in the project's manifest
- The project's Sentry options (
Assets/Resources/Sentry/SentryOptions.asset) get a CrashReportingSentryOptions asset as their options configuration (Create > Polis/ServiceHub/Crash Reporting Sentry Options). The SDK never starts by itself, the manager starts it with the hub's DSN. Builds see a stand-in DSN, so the SDK's build steps keep native crash handling
- Kit prefab
Multiplayer/ServiceHub/CrashReportingManager.prefab, load item CrashReportingManagerLoader with a DefineCondition on SENTRY, so projects without the package skip it
CrashReportingManager : ALoadableServiceBehaviour<CrashReportingManager>, waits for the ServiceHubManager. Max Log Lines (100) - log lines sent with each report
How it works
- At start it reports with the last config it got (kept in
PlayerPrefs), then asks the hub (/crash-reports/config, app secret, selected release channel). The hub hands out the DSN and environment per release channel, or says it's off. ServiceDisabled forgets the kept config and stops, other failures keep reporting with it
- Release
polis@<version>.<build>, e.g. [email protected]
- Tags:
platform (release platform key), side (client or server), the hub user id (no email or address), room (join code of the current session), build (hash of the built-in catalog, matches a crash to its content), ctx.<key> for every RuntimeContext key (see Utilities). Context changes also go into the log trail
- Each distinct error is sent at most once a minute (
ErrorThrottler), so an error logged every frame doesn't flood the reports
- Log timestamps and the query of links (download signatures) are stripped from messages and log lines, so reports group and links don't leak
- No native crashes on Windows, GlitchTip reads no context from crashpad's minidumps
- Off in the editor. The
CRASH_REPORTS_IN_EDITOR define turns it on for testing
-sentryDebug on the command line logs the SDK's own diagnostics, e.g. to see why a crash wasn't sent
crashTest <error|exception|native> command in development builds: sends a test error or crashes the app
- Android debug symbols: the build's
symbols.zip goes with the app build upload, the hub passes them to the crash reports, see Release Content