From 0e8946d79f0d66bfce1794b6bc733465add9dd81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Wed, 14 Dec 2022 11:34:11 +0100 Subject: [PATCH] Allow to overwrite Sentry DSN --- CommonHelpers/Instance.cs | 19 ++++++++++++------- CommonHelpers/Log.cs | 2 +- RELEASE.md | 1 + Updater/Program.cs | 10 ++++++++-- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/CommonHelpers/Instance.cs b/CommonHelpers/Instance.cs index 9267333..dd07ed5 100644 --- a/CommonHelpers/Instance.cs +++ b/CommonHelpers/Instance.cs @@ -164,8 +164,14 @@ namespace CommonHelpers } } - public static void WithSentry(Action action) + public static void WithSentry(Action action, string? dsn = null) { + // Overwrite DSN + if (dsn != null) + { + Log.SENTRY_DSN = dsn; + } + using (Sentry.SentrySdk.Init(Log.SentryOptions)) { action(); @@ -227,17 +233,16 @@ namespace CommonHelpers updateTimer.Start(); } - Sentry.SentrySdk.CaptureMessage("Updater: " + ApplicationName, scope => - { - scope.SetTag("type", user ? "user" : "background"); - }); - try { Process.Start(new ProcessStartInfo() { FileName = "Updater.exe", - ArgumentList = { user ? "-user" : "-first" }, + ArgumentList = { + user ? "-user" : "-first", + "-app", ApplicationName, + "-version", ProductVersion + }, UseShellExecute = false }); } diff --git a/CommonHelpers/Log.cs b/CommonHelpers/Log.cs index 29b881f..2bb8811 100644 --- a/CommonHelpers/Log.cs +++ b/CommonHelpers/Log.cs @@ -5,7 +5,7 @@ namespace CommonHelpers { public static class Log { - internal const String SENTRY_DSN = "https://a6f1925b30fe43529aa7cefd0af7b8a4@o37791.ingest.sentry.io/4504316313993216"; + internal static String SENTRY_DSN = "https://a6f1925b30fe43529aa7cefd0af7b8a4@o37791.ingest.sentry.io/4504316313993216"; #if DEBUG private static bool LogToTrace = true; diff --git a/RELEASE.md b/RELEASE.md index c01a587..0da3649 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -29,3 +29,4 @@ - Fix `Use X360 with Steam` that was broken with `0.5.33` - Add `Sentry` error tracking (updated) - Tune `PowerControl` key repeats +- Improve `Sentry` integration to reduce amount of data being sent diff --git a/Updater/Program.cs b/Updater/Program.cs index 9922911..3ad8e1d 100644 --- a/Updater/Program.cs +++ b/Updater/Program.cs @@ -12,6 +12,7 @@ namespace Updater public const String Title = "Steam Deck Tools"; public const String RunPrefix = "-run="; public const String UpdatedArg = "-updated"; + public const String UPDATER_SENTRY_DSN = "https://a41ee1b3a3294d38887e6f43627f5853@o4504326877216768.ingest.sentry.io/4504326879641600"; /// /// The main entry point for the application. @@ -22,7 +23,7 @@ namespace Updater Instance.WithSentry(() => { Run(); - }); + }, UPDATER_SENTRY_DSN); } static void Run() @@ -53,6 +54,11 @@ namespace Updater Instance.RunOnce(null, "Global\\SteamDeckToolsAutoUpdater"); + Sentry.SentrySdk.CaptureMessage("Updater", scope => + { + scope.SetExtra("args", Environment.GetCommandLineArgs()); + }); + var persistence = new RegistryPersistenceProvider(@"Software\SteamDeckTools\AutoUpdater"); if (userCheck || cmdLine) @@ -85,7 +91,7 @@ namespace Updater TrackProcess("SteamController"); var updateURL = String.Format( - "https://steam-deck-tools.ayufan.dev/updates/{0}_{1}.xml?version={2}&machineID={3}", + "https://steam-deck-tools.ayufan.dev/docs/updates/{0}_{1}.xml?version={2}&machineID={3}", Instance.IsDEBUG ? "debug" : "release", IsUsingInstaller ? "setup" : "zip", HttpUtility.UrlEncode(Instance.ProductVersion),