Allow for opt-in of DF User name for Sentry crash reports

This will help us with triage of bugs for our customers.

Contributes to CURA-11482
This commit is contained in:
Jelle Spijker 2024-01-13 11:12:46 +01:00
parent 34e7ea8185
commit 2bcdacef72
No known key found for this signature in database
GPG key ID: 034D1C0527888B65
2 changed files with 54 additions and 3 deletions

View file

@ -164,6 +164,7 @@ class CuraEngineBackend(QObject, Backend):
application.getPreferences().addPreference("general/auto_slice", False)
application.getPreferences().addPreference("info/send_engine_crash", True)
application.getPreferences().addPreference("info/anonymous_engine_crash_report", True)
self._use_timer: bool = False
@ -198,6 +199,7 @@ class CuraEngineBackend(QObject, Backend):
# Ensure that the initial value for send_engine_crash is handled correctly.
application.callLater(self._onPreferencesChanged, "info/send_engine_crash")
application.callLater(self._onPreferencesChanged, "info/anonymous_engine_crash_report")
def startPlugins(self) -> None:
"""
@ -1094,14 +1096,18 @@ class CuraEngineBackend(QObject, Backend):
self._change_timer.timeout.disconnect(self.slice)
def _onPreferencesChanged(self, preference: str) -> None:
if preference != "general/auto_slice" and preference != "info/send_engine_crash":
if preference != "general/auto_slice" and preference != "info/send_engine_crash" and preference != "info/anonymous_engine_crash_report":
return
if preference == "general/auto_slice":
auto_slice = self.determineAutoSlicing()
if auto_slice:
self._change_timer.start()
elif preference == "info/send_engine_crash":
os.environ["use_sentry"] = "1" if CuraApplication.getInstance().getPreferences().getValue("info/send_engine_crash") else "0"
os.environ["USE_SENTRY"] = "1" if CuraApplication.getInstance().getPreferences().getValue("info/send_engine_crash") else "0"
elif preference == "info/anonymous_engine_crash_report":
account = CuraApplication.getInstance().getCuraAPI().account
if account and account.isLoggedIn and not CuraApplication.getInstance().getPreferences().getValue("info/anonymous_engine_crash_report"):
os.environ["CURAENGINE_SENTRY_USER"] = account.userName
def tickle(self) -> None:
"""Tickle the backend so in case of auto slicing, it starts the timer."""

View file

@ -124,6 +124,9 @@ UM.PreferencesPage
UM.Preferences.resetPreference("info/send_engine_crash")
sendEngineCrashCheckbox.checked = boolCheck(UM.Preferences.getValue("info/send_engine_crash"))
UM.Preferences.resetPreference("info/anonymous_engine_crash_report")
sendEngineCrashCheckboxAnonymous.checked = boolCheck(UM.Preferences.getValue("info/anonymous_engine_crash_report"))
UM.Preferences.resetPreference("info/automatic_update_check")
checkUpdatesCheckbox.checked = boolCheck(UM.Preferences.getValue("info/automatic_update_check"))
@ -859,11 +862,12 @@ UM.PreferencesPage
font: UM.Theme.getFont("medium_bold")
text: catalog.i18nc("@label", "Privacy")
}
UM.TooltipArea
{
width: childrenRect.width
height: visible ? childrenRect.height : 0
text: catalog.i18nc("@info:tooltip", "Should slicing crashes be automatically reported to Ultimaker? Note, no models, IP addresses or other personally identifiable information is sent or stored.")
text: catalog.i18nc("@info:tooltip", "Should slicing crashes be automatically reported to Ultimaker? Note, no models, IP addresses or other personally identifiable information is sent or stored, unless you give explicit permission.")
UM.CheckBox
{
@ -874,6 +878,47 @@ UM.PreferencesPage
}
}
ButtonGroup
{
id: curaCrashGroup
buttons: [sendEngineCrashCheckboxAnonymous, sendEngineCrashCheckboxUser]
}
UM.TooltipArea
{
width: childrenRect.width
height: visible ? childrenRect.height : 0
visible: Cura.API.account.isLoggedIn
text: catalog.i18nc("@info:tooltip", "Send crash reports without any personally identifiable information or models data to UltiMaker.")
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
Cura.RadioButton
{
id: sendEngineCrashCheckboxAnonymous
text: catalog.i18nc("@option:radio", "Anonymous crash reports")
enabled: sendEngineCrashCheckbox.checked
checked: boolCheck(UM.Preferences.getValue("info/anonymous_engine_crash_report"))
onClicked: UM.Preferences.setValue("info/anonymous_engine_crash_report", true)
}
}
UM.TooltipArea
{
width: childrenRect.width
height: visible ? childrenRect.height : 0
visible: Cura.API.account.isLoggedIn
text: catalog.i18nc("@info:tooltip", "Send crash reports with your registered UltiMaker account email adress to UltiMaker. No model data is being send.")
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
Cura.RadioButton
{
id: sendEngineCrashCheckboxUser
text: catalog.i18nc("@option:radio", "Crash reports with email adress")
enabled: sendEngineCrashCheckbox.checked
checked: !boolCheck(UM.Preferences.getValue("info/anonymous_engine_crash_report")) && Cura.API.account.isLoggedIn
onClicked: UM.Preferences.setValue("info/anonymous_engine_crash_report", false)
}
}
UM.TooltipArea
{
width: childrenRect.width