-
-
Notifications
You must be signed in to change notification settings - Fork 294
Infrastructure: add sentry crash reporting #7664
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
base: development
Are you sure you want to change the base?
Conversation
Hey there! Thanks for helping Mudlet improve. 🌟 Test versionsYou can directly test the changes here:
No need to install anything - just unzip and run. |
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.
PR Summary
Here's a summary of the key changes in this PR that adds Sentry crash reporting to Mudlet:
Adds Sentry crash reporting integration with user privacy controls and build-specific configurations:
- Added Sentry native SDK v0.7.17 integration with crashpad handler for crash reporting
- Implemented user-configurable crash reporting settings in preferences dialog for both release and testing builds
- Added debug symbol and source code uploading to sentry.io for better crash analysis
- Disabled IP address collection in sentry settings to protect user privacy
- Added conditional compilation guards to enable/disable Sentry features based on build type
Key implementation points:
- Crash reports are off by default for releases but enabled for testing builds
- Sentry integration is properly isolated behind USE_SENTRY compile flag
- Includes proper cleanup and initialization of Sentry resources
- Added GCC 11 compiler requirement for better C++20 support
- Implemented build system changes to handle debug symbols and crashpad handler
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
11 file(s) reviewed, 8 comment(s)
Edit PR Review Bot Settings | Greptile
URL https://github.com/getsentry/sentry-native/releases/download/0.7.17/sentry-native.zip | ||
SOURCE_SUBDIR "NeedManualAddSubDir" |
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.
style: Add URL_HASH parameter to verify the downloaded archive integrity
FetchContent_Declare( | ||
sentry | ||
URL https://github.com/getsentry/sentry-native/releases/download/0.7.17/sentry-native.zip | ||
SOURCE_SUBDIR "NeedManualAddSubDir" |
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.
logic: SOURCE_SUBDIR value 'NeedManualAddSubDir' appears incorrect - should be the actual subdirectory containing CMakeLists.txt in the Sentry archive
set(SENTRY_VERSION 0.7.17) | ||
set(SENTRY_BACKEND "crashpad" CACHE STRING "Use crashpad backend" FORCE) | ||
set(SENTRY_INTEGRATION_QT "ON" CACHE STRING "Enable Qt integration" FORCE) |
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.
style: These Sentry settings should be marked as advanced CMake options to avoid cluttering the basic configuration
if(USE_UPDATER) | ||
add_subdirectory(3rdparty/dblsqd) | ||
endif() | ||
|
||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON) | ||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE -O3) | ||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_DEBUG -O0) | ||
|
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.
syntax: Trailing whitespace at end of file
${CMAKE_BINARY_DIR}/_deps/sentry-build/crashpad_build/handler/crashpad_handler | ||
$<TARGET_FILE_DIR:mudlet>/crashpad_handler |
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.
style: Path may be incorrect on Windows where backslashes are used. Consider using file(TO_NATIVE_PATH) to ensure cross-platform compatibility.
auto* versions = static_cast<VersionInfo*>(closure); | ||
if (versions->isRelease) { | ||
// For release builds, check smSendCrashesForReleases | ||
if (!mudlet::self()->smSendCrashesForReleases) { |
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.
logic: Accessing mudlet::self() before mudlet::start() could cause a crash
VersionInfo versions{releaseVersion, publicTestVersion, testingVersion}; | ||
sentry_options_set_before_send(options, before_send, &versions); | ||
|
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.
logic: VersionInfo struct passed by pointer but used after scope ends in before_send callback
VersionInfo versions{releaseVersion, publicTestVersion, testingVersion}; | |
sentry_options_set_before_send(options, before_send, &versions); | |
static VersionInfo versions{releaseVersion, publicTestVersion, testingVersion}; | |
sentry_options_set_before_send(options, before_send, &versions); |
checkBox_crashreportsOfficial->setChecked(mudlet::self()->smSendCrashesForReleases); | ||
checkBox_crashreportsTesting->setChecked(mudlet::self()->smSendCrashesForTesting); | ||
// only show the "Crash reports" section for testing/PTB releases if we're on one, | ||
// otherwise don't add visual clutter | ||
if (!mudlet::self()->releaseVersion) { | ||
checkBox_crashreportsTesting->show(); | ||
} else { | ||
checkBox_crashreportsTesting->hide(); | ||
} |
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.
style: Indentation issue - there is an extra space before checkBox_crashreportsTesting->setChecked() that should be removed for consistency
checkBox_crashreportsOfficial->setChecked(mudlet::self()->smSendCrashesForReleases); | |
checkBox_crashreportsTesting->setChecked(mudlet::self()->smSendCrashesForTesting); | |
// only show the "Crash reports" section for testing/PTB releases if we're on one, | |
// otherwise don't add visual clutter | |
if (!mudlet::self()->releaseVersion) { | |
checkBox_crashreportsTesting->show(); | |
} else { | |
checkBox_crashreportsTesting->hide(); | |
} | |
checkBox_crashreportsOfficial->setChecked(mudlet::self()->smSendCrashesForReleases); | |
checkBox_crashreportsTesting->setChecked(mudlet::self()->smSendCrashesForTesting); | |
// only show the "Crash reports" section for testing/PTB releases if we're on one, | |
// otherwise don't add visual clutter | |
if (!mudlet::self()->releaseVersion) { | |
checkBox_crashreportsTesting->show(); | |
} else { | |
checkBox_crashreportsTesting->hide(); | |
} |
Brief overview of PR changes/additions
Add sentry for reporting when crashes happen.
Motivation for adding to Mudlet
So we can tell when Mudlet crashes - and fix any such issues!
Other info (issues closed, discussion etc)
IP address collection has been disabled in sentry settings to protect privacy of those who upload a crash.
This is a re-run of #7618 but from the Mudlet repository, enabling secrets and thus sentry upload.
This PR is still a work in progress. TODO: