add:Dlass遥测

This commit is contained in:
2026-02-06 22:47:41 +08:00
parent 22555b835b
commit 7a24faece1
2 changed files with 41 additions and 0 deletions
+39
View File
@@ -20,6 +20,7 @@ using Application = System.Windows.Application;
using MessageBox = System.Windows.MessageBox;
using SplashScreen = Ink_Canvas.Windows.SplashScreen;
using Timer = System.Threading.Timer;
using Sentry;
namespace Ink_Canvas
{
@@ -72,6 +73,26 @@ namespace Ink_Canvas
{
}
try
{
var dsn = GetDlassTelemetryDsn();
if (!string.IsNullOrWhiteSpace(dsn))
{
SentrySdk.Init(options =>
{
options.Dsn = dsn;
options.Debug = false;
options.SendDefaultPii = true;
options.TracesSampleRate = 1.0;
options.IsGlobalModeEnabled = true;
});
}
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"初始化 Dlass 遥测失败: {ex}", LogHelper.LogType.Warning);
}
// 配置TLS协议以支持Windows 7
ConfigureTlsForWindows7();
@@ -1238,6 +1259,24 @@ namespace Ink_Canvas
}
}
internal static string GetDlassTelemetryDsn()
{
try
{
var envDsn = Environment.GetEnvironmentVariable("DLASS_SENTRY_DSN");
if (!string.IsNullOrWhiteSpace(envDsn))
{
return envDsn;
}
return "https://9aa07b78ee2a43edae34cc6c116ce90a@iccce.dlass.tech/2";
}
catch
{
return string.Empty;
}
}
private void App_Exit(object sender, ExitEventArgs e)
{
// 仅在软件内主动退出时关闭看门狗,并写入退出信号