Allow to overwrite Sentry DSN

This commit is contained in:
Kamil Trzciński 2022-12-14 11:34:11 +01:00
parent 4d570c30d6
commit 0e8946d79f
4 changed files with 22 additions and 10 deletions

View file

@ -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
});
}

View file

@ -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;

View file

@ -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

View file

@ -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";
/// <summary>
/// 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),