Update Sentry logging

This commit is contained in:
Kamil Trzciński 2022-12-12 20:03:15 +01:00
parent 4131d972ed
commit a339037e01
3 changed files with 21 additions and 5 deletions

View file

@ -2,6 +2,7 @@ using System.Security.Principal;
using System.Security.AccessControl;
using Microsoft.Win32;
using System.Diagnostics;
using System.Reflection;
namespace CommonHelpers
{
@ -171,13 +172,18 @@ namespace CommonHelpers
}
}
public static String ApplicationName
{
get { return Assembly.GetEntryAssembly()?.GetName().Name ?? "unknown"; }
}
public static String MachineID
{
get
{
try
{
using (var registryKey = Registry.CurrentUser.OpenSubKey(@"Software\SteamDeckTools", true))
using (var registryKey = Registry.CurrentUser.CreateSubKey(@"Software\SteamDeckTools", true))
{
var machineID = registryKey?.GetValue("MachineID") as string;
if (machineID is null)
@ -221,6 +227,11 @@ namespace CommonHelpers
updateTimer.Start();
}
Sentry.SentrySdk.CaptureMessage("Updater: " + ApplicationName, scope =>
{
scope.SetTag("type", user ? "user" : "background");
});
try
{
Process.Start(new ProcessStartInfo()

View file

@ -16,12 +16,17 @@ namespace CommonHelpers
internal static void SentryOptions(Sentry.SentryOptions o)
{
var build = Instance.IsDEBUG ? "debug" : "release";
var type = File.Exists("Uninstaller.exe") ? "setup" : "zip";
o.Dsn = Log.SENTRY_DSN;
o.Environment = File.Exists("Uninstaller.exe") ? "setup_" : "zip_";
o.Environment += Instance.IsDEBUG ? "debug" : "release";
o.TracesSampleRate = 1.0;
o.IsGlobalModeEnabled = true;
o.Environment = String.Format("{0}:{1}_{2}", Instance.ApplicationName, build, type);
o.DefaultTags.Add("App", Instance.ApplicationName);
o.DefaultTags.Add("MachineID", Instance.MachineID);
o.DefaultTags.Add("Build", type);
o.DefaultTags.Add("Configuration", build);
var releaseVersion = typeof(Log).Assembly.GetCustomAttributes<AssemblyInformationalVersionAttribute>().FirstOrDefault();
if (releaseVersion is not null)

View file

@ -27,5 +27,5 @@
- Add `Updater.exe` that can update to latest release and debug
- Add `Setup.exe` installer to install all except RTSS
- Fix `Use X360 with Steam` that was broken with `0.5.33`
- Add `Sentry` error tracking
- Tune `PowerControl` key repeats
- Add `Sentry` error tracking (updated)
- Tune `PowerControl` key repeats