Skip to content

Commit f26754d

Browse files
authored
Add setting allowing to opt-out Crash Reporter wrapper instantiation (#1178)
* Add setting allowing to opt-out Crash Reporter wrapper intantiation * Update changelog
1 parent 2df5138 commit f26754d

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Features
6+
7+
- Add plugin setting to opt out of automatic Crash Reporter context propagation ([#1178](https://github.com/getsentry/sentry-unreal/pull/1178))
8+
59
### Fixes
610

711
- Misleading screenshot capture logs on unsupported platforms ([#1180](https://github.com/getsentry/sentry-unreal/pull/1180))

plugin-dev/Source/Sentry/Private/Linux/LinuxSentrySubsystem.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ void FLinuxSentrySubsystem::InitWithSettings(const USentrySettings* Settings, US
1717
{
1818
FGenericPlatformSentrySubsystem::InitWithSettings(Settings, BeforeSendHandler, BeforeBreadcrumbHandler, BeforeLogHandler, TraceSampler);
1919

20-
InitCrashReporter(Settings->GetEffectiveRelease(), Settings->GetEffectiveEnvironment());
20+
if (Settings->EnableCrashReporterContextPropagation)
21+
{
22+
InitCrashReporter(Settings->GetEffectiveRelease(), Settings->GetEffectiveEnvironment());
23+
}
2124

2225
// Add platform context if detected
2326
if (IsEnabled())

plugin-dev/Source/Sentry/Private/Microsoft/MicrosoftSentrySubsystem.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,15 @@ void FMicrosoftSentrySubsystem::InitWithSettings(const USentrySettings* Settings
4747
FPlatformMisc::SetCrashHandlingType(Settings->EnableAutoCrashCapturing ? ECrashHandlingType::Disabled : ECrashHandlingType::Default);
4848
}
4949

50-
if (FPlatformMisc::GetCrashHandlingType() == ECrashHandlingType::Default)
50+
if (FPlatformMisc::GetCrashHandlingType() == ECrashHandlingType::Default && Settings->EnableCrashReporterContextPropagation)
5151
{
5252
InitCrashReporter(Settings->GetEffectiveRelease(), Settings->GetEffectiveEnvironment());
5353
}
5454
#else
55-
InitCrashReporter(Settings->GetEffectiveRelease(), Settings->GetEffectiveEnvironment());
55+
if (Settings->EnableCrashReporterContextPropagation)
56+
{
57+
InitCrashReporter(Settings->GetEffectiveRelease(), Settings->GetEffectiveEnvironment());
58+
}
5659
#endif
5760
}
5861

plugin-dev/Source/Sentry/Private/SentrySettings.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ USentrySettings::USentrySettings(const FObjectInitializer& ObjectInitializer)
6363
, DiagnosticLevel(ESentryCliLogLevel::Info)
6464
, UseLegacyGradlePlugin(false)
6565
, CrashReporterUrl()
66+
, EnableCrashReporterContextPropagation(true)
6667
, bRequireUserConsent(false)
6768
, bDefaultUserConsentGiven(true)
6869
, bIsDirty(false)
@@ -92,7 +93,8 @@ void USentrySettings::PostEditChangeProperty(FPropertyChangedEvent& PropertyChan
9293
PropertyChangedEvent.Property->GetFName() == GET_MEMBER_NAME_CHECKED(USentrySettings, IncludeSources) ||
9394
PropertyChangedEvent.Property->GetFName() == GET_MEMBER_NAME_CHECKED(USentrySettings, UseLegacyGradlePlugin) ||
9495
PropertyChangedEvent.Property->GetFName() == GET_MEMBER_NAME_CHECKED(USentrySettings, DiagnosticLevel) ||
95-
PropertyChangedEvent.Property->GetFName() == GET_MEMBER_NAME_CHECKED(USentrySettings, CrashReporterUrl))
96+
PropertyChangedEvent.Property->GetFName() == GET_MEMBER_NAME_CHECKED(USentrySettings, CrashReporterUrl) ||
97+
PropertyChangedEvent.Property->GetFName() == GET_MEMBER_NAME_CHECKED(USentrySettings, EnableCrashReporterContextPropagation))
9698
{
9799
return;
98100
}

plugin-dev/Source/Sentry/Public/SentrySettings.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,10 @@ class SENTRY_API USentrySettings : public UObject
421421
Meta = (DisplayName = "Crash Reporter Endpoint", ToolTip = "Endpoint that Unreal Engine Crah Reporter should use in order to upload crash data to Sentry."))
422422
FString CrashReporterUrl;
423423

424+
UPROPERTY(Config, EditAnywhere, Category = "Crash Reporter",
425+
Meta = (DisplayName = "Allow Crash Reporter context propagation", ToolTip = "Flag indicating whether to automatically propagate additional data (e.g., tags, context) set via Sentry SDK interface to Crash Reporter."))
426+
bool EnableCrashReporterContextPropagation;
427+
424428
UPROPERTY(Config, EditAnywhere, Category = "General|Consent",
425429
Meta = (DisplayName = "Require User Consent (for Windows/Linux only)", ToolTip = "True if user's consent is required before uploading crash data. Currently this feature is supported for Windows and Linux only."))
426430
bool bRequireUserConsent;

0 commit comments

Comments
 (0)