diff --git a/plugin-dev/Source/Sentry/Private/Desktop/CrashReporter/SentryCrashContext.cpp b/plugin-dev/Source/Sentry/Private/Desktop/CrashReporter/SentryCrashContext.cpp index 67c6add7..e5b72ecc 100644 --- a/plugin-dev/Source/Sentry/Private/Desktop/CrashReporter/SentryCrashContext.cpp +++ b/plugin-dev/Source/Sentry/Private/Desktop/CrashReporter/SentryCrashContext.cpp @@ -1,12 +1,9 @@ #include "SentryCrashContext.h" -#include "Desktop/SentryScopeDesktop.h" - -#include "GenericPlatform/GenericPlatformDriver.h" +#include "SentrySettings.h" +#include "SentryModule.h" -#if PLATFORM_WINDOWS -#include "Windows/WindowsPlatformMisc.h" -#endif +#include "Desktop/SentryScopeDesktop.h" #if USE_SENTRY_NATIVE @@ -17,6 +14,8 @@ FSentryCrashContext::FSentryCrashContext(const FSharedCrashContext& Context) void FSentryCrashContext::Apply(TSharedPtr Scope) { + const USentrySettings* Settings = FSentryModule::Get().GetSettings(); + const FSessionContext& SessionContext = CrashContext.SessionContext; Scope->SetExtraValue("Crash Type", FGenericCrashContext::GetCrashTypeString(CrashContext.CrashType)); @@ -29,8 +28,6 @@ void FSentryCrashContext::Apply(TSharedPtr Scope) Scope->SetExtraValue("Base Dir", SessionContext.BaseDir); Scope->SetExtraValue("Is Source Distribution", SessionContext.bIsSourceDistribution ? TEXT("true") : TEXT("false")); Scope->SetExtraValue("Crash GUID", SessionContext.CrashGUIDRoot); - Scope->SetExtraValue("Epic Account Id", SessionContext.EpicAccountId); - Scope->SetExtraValue("Login Id", SessionContext.LoginIdStr); Scope->SetExtraValue("Executable Name", SessionContext.ExecutableName); Scope->SetExtraValue("Game Name", SessionContext.GameName); Scope->SetExtraValue("CPU Brand", SessionContext.CPUBrand); @@ -44,14 +41,11 @@ void FSentryCrashContext::Apply(TSharedPtr Scope) Scope->SetExtraValue("Memory Stats Total Physical GB", FString::FromInt(SessionContext.MemoryStats.TotalPhysicalGB)); Scope->SetExtraValue("Memory Stats Total Virtual", FString::Printf(TEXT("%lld"), SessionContext.MemoryStats.TotalVirtual)); - FGPUDriverInfo GpuDriverInfo = FPlatformMisc::GetGPUDriverInfo(FPlatformMisc::GetPrimaryGPUBrand()); - - TMap GpuContext; - GpuContext.Add(TEXT("name"), GpuDriverInfo.DeviceDescription); - GpuContext.Add(TEXT("vendor_name"), GpuDriverInfo.ProviderName); - GpuContext.Add(TEXT("driver_version"), GpuDriverInfo.UserDriverVersion); - - Scope->SetContext(TEXT("gpu"), GpuContext); + if(Settings->SendDefaultPii) + { + Scope->SetExtraValue("Epic Account Id", SessionContext.EpicAccountId); + Scope->SetExtraValue("Login Id", SessionContext.LoginIdStr); + } } #endif \ No newline at end of file diff --git a/plugin-dev/Source/Sentry/Private/SentrySubsystem.cpp b/plugin-dev/Source/Sentry/Private/SentrySubsystem.cpp index b5239009..6a855386 100644 --- a/plugin-dev/Source/Sentry/Private/SentrySubsystem.cpp +++ b/plugin-dev/Source/Sentry/Private/SentrySubsystem.cpp @@ -15,6 +15,7 @@ #include "Misc/EngineVersion.h" #include "Misc/CoreDelegates.h" #include "Misc/App.h" +#include "GenericPlatform/GenericPlatformDriver.h" #include "GenericPlatform/GenericPlatformMisc.h" #include "Interface/SentrySubsystemInterface.h" @@ -89,6 +90,11 @@ void USentrySubsystem::Initialize() } AddDefaultContext(); + +#if PLATFORM_WINDOWS || PLATFORM_LINUX || PLATFORM_MAC + AddGpuContext(); +#endif + PromoteTags(); ConfigureBreadcrumbs(); } @@ -288,6 +294,18 @@ void USentrySubsystem::AddDefaultContext() SubsystemNativeImpl->SetContext(TEXT("Unreal Engine"), DefaultContext); } +void USentrySubsystem::AddGpuContext() +{ + FGPUDriverInfo GpuDriverInfo = FPlatformMisc::GetGPUDriverInfo(FPlatformMisc::GetPrimaryGPUBrand()); + + TMap GpuContext; + GpuContext.Add(TEXT("name"), GpuDriverInfo.DeviceDescription); + GpuContext.Add(TEXT("vendor_name"), GpuDriverInfo.ProviderName); + GpuContext.Add(TEXT("driver_version"), GpuDriverInfo.UserDriverVersion); + + SubsystemNativeImpl->SetContext(TEXT("gpu"), GpuContext); +} + void USentrySubsystem::PromoteTags() { const USentrySettings* Settings = FSentryModule::Get().GetSettings(); diff --git a/plugin-dev/Source/Sentry/Public/SentrySubsystem.h b/plugin-dev/Source/Sentry/Public/SentrySubsystem.h index 93689a08..1796b629 100644 --- a/plugin-dev/Source/Sentry/Public/SentrySubsystem.h +++ b/plugin-dev/Source/Sentry/Public/SentrySubsystem.h @@ -234,6 +234,9 @@ class SENTRY_API USentrySubsystem : public UGameInstanceSubsystem /** Adds default context data for all events captured by Sentry SDK. */ void AddDefaultContext(); + /** Adds GPU context data for all events captured by Sentry SDK. */ + void AddGpuContext(); + /** Promote specified values to tags for all events captured by Sentry SDK. */ void PromoteTags();