Skip to content

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

Draft
wants to merge 76 commits into
base: development
Choose a base branch
from

Conversation

vadi2
Copy link
Member

@vadi2 vadi2 commented Jan 15, 2025

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:

  • get Linux to report line #'s in stack traces reliably
  • add sentry integration into AppImages, enable it for testing/ptb/release builds
  • upload source code in Linux build
  • upload debug symbols for Mudlet and Luarocks .so's to sentry for Linux
  • add sentry integration for macOS and test
  • upload source code in macOS build (duplicate uploads for simplicity)
  • upload debug symbols for Mudlet and Luarocks .so's to sentry for macOS
  • add sentry integration into macOS packaging, enable it for testing/ptb/release builds

vadi2 and others added 30 commits December 29, 2024 18:57
  Error:   CURL: Required feature AsynchDNS is not found
…add-sentry-crash-reporting

# Conflicts:
#	.github/workflows/build-mudlet.yml
@add-deployment-links
Copy link

add-deployment-links bot commented Jan 15, 2025

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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

Comment on lines +9 to +10
URL https://github.com/getsentry/sentry-native/releases/download/0.7.17/sentry-native.zip
SOURCE_SUBDIR "NeedManualAddSubDir"
Copy link
Contributor

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"
Copy link
Contributor

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

Comment on lines +224 to +226
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)
Copy link
Contributor

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)

Copy link
Contributor

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

Suggested change

Comment on lines +636 to +637
${CMAKE_BINARY_DIR}/_deps/sentry-build/crashpad_build/handler/crashpad_handler
$<TARGET_FILE_DIR:mudlet>/crashpad_handler
Copy link
Contributor

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) {
Copy link
Contributor

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

Comment on lines +289 to +291
VersionInfo versions{releaseVersion, publicTestVersion, testingVersion};
sentry_options_set_before_send(options, before_send, &versions);

Copy link
Contributor

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

Suggested change
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);

Comment on lines +280 to +288
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();
}
Copy link
Contributor

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

Suggested change
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();
}

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.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy