mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-11-30 09:07:14 +02:00
Updated way Sentry gets configured and enabled.
This commit is contained in:
parent
e126c45fb3
commit
b1eec16333
30
build.sh
30
build.sh
@ -198,25 +198,25 @@ PackageMono()
|
|||||||
# See: https://github.com/mono/mono/blob/master/tools/nuget-hash-extractor/download.sh
|
# See: https://github.com/mono/mono/blob/master/tools/nuget-hash-extractor/download.sh
|
||||||
# That list defines assemblies that are prohibited from being loaded from the appdir, instead loading from mono GAC.
|
# That list defines assemblies that are prohibited from being loaded from the appdir, instead loading from mono GAC.
|
||||||
|
|
||||||
# We have debian dependencies to get these installed
|
# We have debian dependencies to get these installed or facades from mono 5.10+
|
||||||
for assembly in System.IO.Compression System.Runtime.InteropServices.RuntimeInformation System.Net.Http
|
for assembly in System.IO.Compression System.Runtime.InteropServices.RuntimeInformation System.Net.Http System.Globalization.Extensions System.Text.Encoding.CodePages System.Threading.Overlapped
|
||||||
do
|
do
|
||||||
if [ -e $outputFolderLinux/$assembly.dll ] ; then
|
if [ -e $outputFolderLinux/$assembly.dll ]; then
|
||||||
echo "Remove $assembly.dll (uses win32 interop)"
|
if [ -e $sourceFolder/Libraries/Mono/$assembly.dll ]; then
|
||||||
rm $outputFolderLinux/$assembly.dll
|
echo "Copy Mono-specific facade $assembly.dll (uses win32 interop)"
|
||||||
fi
|
cp $sourceFolder/Libraries/Mono/$assembly.dll $outputFolderLinux/$assembly.dll
|
||||||
done
|
else
|
||||||
|
echo "Remove $assembly.dll (uses win32 interop)"
|
||||||
# These assemblies have facades in mono-devel, but we don't have them.
|
rm $outputFolderLinux/$assembly.dll
|
||||||
for assembly in System.Globalization.Extensions System.Text.Encoding.CodePages System.Threading.Overlapped
|
fi
|
||||||
do
|
|
||||||
if [ -e $outputFolderLinux/$assembly.dll ] ; then
|
|
||||||
echo "Warn: Facade $assembly.dll (uses win32 interop)"
|
|
||||||
rm $outputFolderLinux/$assembly.dll
|
|
||||||
#exit 1
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Remove Http binding redirect by renaming it
|
||||||
|
# We don't need this anymore once our minimum mono version is 5.10
|
||||||
|
sed -i "s/System.Net.Http/System.Net.Http.Mono/g" $outputFolderLinux/Sonarr.Console.exe.config
|
||||||
|
|
||||||
echo "Renaming Sonarr.Console.exe to Sonarr.exe"
|
echo "Renaming Sonarr.Console.exe to Sonarr.exe"
|
||||||
rm $outputFolderLinux/Sonarr.exe*
|
rm $outputFolderLinux/Sonarr.exe*
|
||||||
for file in $outputFolderLinux/Sonarr.Console.exe*; do
|
for file in $outputFolderLinux/Sonarr.Console.exe*; do
|
||||||
|
@ -16,7 +16,7 @@ Architecture: all
|
|||||||
Provides: nzbdrone
|
Provides: nzbdrone
|
||||||
Conflicts: nzbdrone
|
Conflicts: nzbdrone
|
||||||
Replaces: nzbdrone
|
Replaces: nzbdrone
|
||||||
Depends: adduser, libsqlite3-0 (>= 3.7), libmediainfo0v5 (>= 0.7.52) | libmediainfo0 (>= 0.7.52), mono-runtime (>= 5.4), libmono-system-runtime-interopservices-runtimeinformation4.0-cil (>= 4.0.0~alpha1), libmono-system-net-http4.0-cil (>= 4.0.0~alpha1), ${cli:Depends}, ${misc:Depends}
|
Depends: adduser, libsqlite3-0 (>= 3.7), libmediainfo0v5 (>= 0.7.52) | libmediainfo0 (>= 0.7.52), mono-runtime (>= 5.4), libmono-system-net-http4.0-cil (>= 4.0.0~alpha1), ${cli:Depends}, ${misc:Depends}
|
||||||
Recommends: libmediainfo0v5 (>= 18.03) | libmediainfo0 (>= 18.03)
|
Recommends: libmediainfo0v5 (>= 18.03) | libmediainfo0 (>= 18.03)
|
||||||
Suggests: sqlite3 (>= 3.7), mediainfo (>= 0.7.52)
|
Suggests: sqlite3 (>= 3.7), mediainfo (>= 0.7.52)
|
||||||
Description: Internet PVR
|
Description: Internet PVR
|
||||||
|
BIN
src/Libraries/Mono/System.Globalization.Extensions.dll
Normal file
BIN
src/Libraries/Mono/System.Globalization.Extensions.dll
Normal file
Binary file not shown.
Binary file not shown.
BIN
src/Libraries/Mono/System.Text.Encoding.CodePages.dll
Normal file
BIN
src/Libraries/Mono/System.Text.Encoding.CodePages.dll
Normal file
Binary file not shown.
BIN
src/Libraries/Mono/System.Threading.Overlapped.dll
Normal file
BIN
src/Libraries/Mono/System.Threading.Overlapped.dll
Normal file
Binary file not shown.
3
src/Libraries/Mono/readme.txt
Normal file
3
src/Libraries/Mono/readme.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Copied from mono/4.5/Facades of the mono 5.4 release.
|
||||||
|
These are the mono version of the dotnet Core TypeForwardedTo assemblies.
|
||||||
|
Using these assemblies is no longer necessary once we reach mono 5.18 as minimum version
|
@ -82,9 +82,6 @@ public OsInfo(IEnumerable<IOsVersionAdapter> versionAdapters, Logger logger)
|
|||||||
Name = Os.ToString();
|
Name = Os.ToString();
|
||||||
FullName = Name;
|
FullName = Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
Environment.SetEnvironmentVariable("OS_NAME", Name);
|
|
||||||
Environment.SetEnvironmentVariable("OS_VERSION", Version);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,16 @@ public RuntimeInfo(IServiceProvider serviceProvider, Logger logger)
|
|||||||
|
|
||||||
static RuntimeInfo()
|
static RuntimeInfo()
|
||||||
{
|
{
|
||||||
IsProduction = InternalIsProduction();
|
var officialBuild = InternalIsOfficialBuild();
|
||||||
|
|
||||||
|
// An build running inside of the testing environment. (Analytics disabled)
|
||||||
|
IsTesting = InternalIsTesting();
|
||||||
|
|
||||||
|
// An official build running outside of the testing environment. (Analytics configurable)
|
||||||
|
IsProduction = !IsTesting && officialBuild;
|
||||||
|
|
||||||
|
// An unofficial build running outside of the testing environment. (Analytics enabled)
|
||||||
|
IsDevelopment = !IsTesting && !officialBuild && !InternalIsDebug();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime StartTime
|
public DateTime StartTime
|
||||||
@ -104,23 +113,21 @@ public RuntimeMode Mode
|
|||||||
public bool RestartPending { get; set; }
|
public bool RestartPending { get; set; }
|
||||||
public string ExecutingApplication { get; }
|
public string ExecutingApplication { get; }
|
||||||
|
|
||||||
|
public static bool IsTesting { get; }
|
||||||
public static bool IsProduction { get; }
|
public static bool IsProduction { get; }
|
||||||
|
public static bool IsDevelopment { get; }
|
||||||
|
|
||||||
private static bool InternalIsProduction()
|
|
||||||
|
private static bool InternalIsTesting()
|
||||||
{
|
{
|
||||||
if (BuildInfo.IsDebug || Debugger.IsAttached) return false;
|
|
||||||
|
|
||||||
//Official builds will never have such a high revision
|
|
||||||
if (BuildInfo.Version.Revision > 10000) return false;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var lowerProcessName = Process.GetCurrentProcess().ProcessName.ToLower();
|
var lowerProcessName = Process.GetCurrentProcess().ProcessName.ToLower();
|
||||||
|
|
||||||
if (lowerProcessName.Contains("vshost")) return false;
|
if (lowerProcessName.Contains("vshost")) return true;
|
||||||
if (lowerProcessName.Contains("nunit")) return false;
|
if (lowerProcessName.Contains("nunit")) return true;
|
||||||
if (lowerProcessName.Contains("jetbrain")) return false;
|
if (lowerProcessName.Contains("jetbrain")) return true;
|
||||||
if (lowerProcessName.Contains("resharper")) return false;
|
if (lowerProcessName.Contains("resharper")) return true;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@ -130,7 +137,7 @@ private static bool InternalIsProduction()
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var currentAssemblyLocation = typeof(RuntimeInfo).Assembly.Location;
|
var currentAssemblyLocation = typeof(RuntimeInfo).Assembly.Location;
|
||||||
if (currentAssemblyLocation.ToLower().Contains("_output")) return false;
|
if (currentAssemblyLocation.ToLower().Contains("_output")) return true;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@ -138,9 +145,24 @@ private static bool InternalIsProduction()
|
|||||||
}
|
}
|
||||||
|
|
||||||
var lowerCurrentDir = Directory.GetCurrentDirectory().ToLower();
|
var lowerCurrentDir = Directory.GetCurrentDirectory().ToLower();
|
||||||
if (lowerCurrentDir.Contains("teamcity")) return false;
|
if (lowerCurrentDir.Contains("teamcity")) return true;
|
||||||
if (lowerCurrentDir.Contains("buildagent")) return false;
|
if (lowerCurrentDir.Contains("buildagent")) return true;
|
||||||
if (lowerCurrentDir.Contains("_output")) return false;
|
if (lowerCurrentDir.Contains("_output")) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool InternalIsDebug()
|
||||||
|
{
|
||||||
|
if (BuildInfo.IsDebug || Debugger.IsAttached) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool InternalIsOfficialBuild()
|
||||||
|
{
|
||||||
|
//Official builds will never have such a high revision
|
||||||
|
if (BuildInfo.Version.Major >= 10 || BuildInfo.Version.Revision > 10000) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
28
src/NzbDrone.Common/Instrumentation/InitializeLogger.cs
Normal file
28
src/NzbDrone.Common/Instrumentation/InitializeLogger.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using NLog;
|
||||||
|
using NLog.Fluent;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
|
using NzbDrone.Common.Instrumentation.Extensions;
|
||||||
|
using NzbDrone.Common.Instrumentation.Sentry;
|
||||||
|
|
||||||
|
namespace NzbDrone.Common.Instrumentation
|
||||||
|
{
|
||||||
|
public class InitializeLogger
|
||||||
|
{
|
||||||
|
private readonly IOsInfo _osInfo;
|
||||||
|
|
||||||
|
public InitializeLogger(IOsInfo osInfo)
|
||||||
|
{
|
||||||
|
_osInfo = osInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialize()
|
||||||
|
{
|
||||||
|
var sentryTarget = LogManager.Configuration.AllTargets.OfType<SentryTarget>().FirstOrDefault();
|
||||||
|
if (sentryTarget != null)
|
||||||
|
{
|
||||||
|
sentryTarget.UpdateScope(_osInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -60,18 +60,6 @@ public static void Register(IStartupContext startupContext, bool updateApp, bool
|
|||||||
LogManager.ReconfigExistingLoggers();
|
LogManager.ReconfigExistingLoggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UnRegisterRemoteLoggers()
|
|
||||||
{
|
|
||||||
var sentryRules = LogManager.Configuration.LoggingRules.Where(r => r.Targets.Any(t => t.Name == "sentryTarget"));
|
|
||||||
|
|
||||||
foreach (var rules in sentryRules)
|
|
||||||
{
|
|
||||||
rules.Targets.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
LogManager.ReconfigExistingLoggers();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void RegisterLogEntries()
|
private static void RegisterLogEntries()
|
||||||
{
|
{
|
||||||
var target = new LogentriesTarget();
|
var target = new LogentriesTarget();
|
||||||
@ -92,15 +80,15 @@ private static void RegisterSentry(bool updateClient)
|
|||||||
if (updateClient)
|
if (updateClient)
|
||||||
{
|
{
|
||||||
dsn = RuntimeInfo.IsProduction
|
dsn = RuntimeInfo.IsProduction
|
||||||
? "https://b85aa82c65b84b0e99e3b7c281438357:392b5bc007974147a922c5d841c47cf9@sentry.sonarr.tv/11"
|
? "https://80777986b95f44a1a90d1eb2f3af1e36@sentry.sonarr.tv/11"
|
||||||
: "https://6168f0946aba4e60ac23e469ac08eac5:bd59e8454ccc454ea27a90cff1f814ca@sentry.sonarr.tv/9";
|
: "https://6168f0946aba4e60ac23e469ac08eac5@sentry.sonarr.tv/9";
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dsn = RuntimeInfo.IsProduction
|
dsn = RuntimeInfo.IsProduction
|
||||||
? "https://a013727b8d224e719894e1e13ff4966b:c95ca1f9ca02418d829db10c2938baf4@sentry.sonarr.tv/8"
|
? "https://e2adcbe52caf46aeaebb6b1dcdfe10a1@sentry.sonarr.tv/8"
|
||||||
: "https://4ee3580e01d8407c96a7430fbc953512:5f2d07227a0b4fde99dea07041a3ff93@sentry.sonarr.tv/10";
|
: "https://4ee3580e01d8407c96a7430fbc953512@sentry.sonarr.tv/10";
|
||||||
}
|
}
|
||||||
|
|
||||||
Target target;
|
Target target;
|
||||||
@ -114,6 +102,7 @@ private static void RegisterSentry(bool updateClient)
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("Failed to load dependency, may need an OS update: " + ex.ToString());
|
||||||
LogManager.GetLogger(nameof(NzbDroneLogger)).Debug(ex, "Failed to load dependency, may need an OS update");
|
LogManager.GetLogger(nameof(NzbDroneLogger)).Debug(ex, "Failed to load dependency, may need an OS update");
|
||||||
|
|
||||||
// We still need the logging rules, so use a null target.
|
// We still need the logging rules, so use a null target.
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SQLite;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Data.SQLite;
|
|
||||||
using NLog;
|
using NLog;
|
||||||
using NLog.Common;
|
using NLog.Common;
|
||||||
using NLog.Targets;
|
using NLog.Targets;
|
||||||
using NzbDrone.Common.EnvironmentInfo;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
|
using NzbDrone.Common.Extensions;
|
||||||
using Sentry;
|
using Sentry;
|
||||||
using Sentry.Protocol;
|
using Sentry.Protocol;
|
||||||
|
|
||||||
@ -75,6 +77,7 @@ public class SentryTarget : TargetWithLayout
|
|||||||
{LogLevel.Warn, BreadcrumbLevel.Warning},
|
{LogLevel.Warn, BreadcrumbLevel.Warning},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private readonly DateTime _startTime = DateTime.UtcNow;
|
||||||
private readonly IDisposable _sdk;
|
private readonly IDisposable _sdk;
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
|
|
||||||
@ -82,10 +85,11 @@ public class SentryTarget : TargetWithLayout
|
|||||||
private bool _unauthorized;
|
private bool _unauthorized;
|
||||||
|
|
||||||
public bool FilterEvents { get; set; }
|
public bool FilterEvents { get; set; }
|
||||||
public string UpdateBranch { get; set; }
|
|
||||||
public Version DatabaseVersion { get; set; }
|
public Version DatabaseVersion { get; set; }
|
||||||
public int DatabaseMigration { get; set; }
|
public int DatabaseMigration { get; set; }
|
||||||
|
|
||||||
|
public bool SentryEnabled { get; set; }
|
||||||
|
|
||||||
public SentryTarget(string dsn)
|
public SentryTarget(string dsn)
|
||||||
{
|
{
|
||||||
_sdk = SentrySdk.Init(o =>
|
_sdk = SentrySdk.Init(o =>
|
||||||
@ -93,34 +97,71 @@ public SentryTarget(string dsn)
|
|||||||
o.Dsn = new Dsn(dsn);
|
o.Dsn = new Dsn(dsn);
|
||||||
o.AttachStacktrace = true;
|
o.AttachStacktrace = true;
|
||||||
o.MaxBreadcrumbs = 200;
|
o.MaxBreadcrumbs = 200;
|
||||||
o.SendDefaultPii = true;
|
o.SendDefaultPii = false;
|
||||||
|
o.AttachStacktrace = true;
|
||||||
o.Debug = false;
|
o.Debug = false;
|
||||||
o.DiagnosticsLevel = SentryLevel.Debug;
|
o.DiagnosticsLevel = SentryLevel.Debug;
|
||||||
o.Release = BuildInfo.Release;
|
o.Release = BuildInfo.Release;
|
||||||
|
if (PlatformInfo.IsMono)
|
||||||
|
{
|
||||||
|
// Mono 6.0 broke GzipStream.WriteAsync
|
||||||
|
// TODO: Check specific version
|
||||||
|
o.RequestBodyCompressionLevel = System.IO.Compression.CompressionLevel.NoCompression;
|
||||||
|
}
|
||||||
o.BeforeSend = x => SentryCleanser.CleanseEvent(x);
|
o.BeforeSend = x => SentryCleanser.CleanseEvent(x);
|
||||||
o.BeforeBreadcrumb = x => SentryCleanser.CleanseBreadcrumb(x);
|
o.BeforeBreadcrumb = x => SentryCleanser.CleanseBreadcrumb(x);
|
||||||
|
o.Environment = BuildInfo.Branch;
|
||||||
});
|
});
|
||||||
|
|
||||||
SentrySdk.ConfigureScope(scope =>
|
InitializeScope();
|
||||||
{
|
|
||||||
scope.User = new User {
|
|
||||||
Username = HashUtil.AnonymousToken()
|
|
||||||
};
|
|
||||||
|
|
||||||
scope.SetTag("osfamily", OsInfo.Os.ToString());
|
|
||||||
scope.SetTag("runtime", PlatformInfo.PlatformName);
|
|
||||||
scope.SetTag("culture", Thread.CurrentThread.CurrentCulture.Name);
|
|
||||||
scope.SetTag("branch", BuildInfo.Branch);
|
|
||||||
scope.SetTag("version", BuildInfo.Version.ToString());
|
|
||||||
scope.SetTag("production", RuntimeInfo.IsProduction.ToString());
|
|
||||||
});
|
|
||||||
|
|
||||||
_debounce = new SentryDebounce();
|
_debounce = new SentryDebounce();
|
||||||
|
|
||||||
// initialize to true and reconfigure later
|
// initialize to true and reconfigure later
|
||||||
// Otherwise it will default to false and any errors occuring
|
// Otherwise it will default to false and any errors occuring
|
||||||
// before config file gets read will not be filtered
|
// before config file gets read will not be filtered
|
||||||
FilterEvents = true;
|
FilterEvents = true;
|
||||||
|
|
||||||
|
SentryEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitializeScope()
|
||||||
|
{
|
||||||
|
SentrySdk.ConfigureScope(scope =>
|
||||||
|
{
|
||||||
|
scope.User = new User
|
||||||
|
{
|
||||||
|
Id = HashUtil.AnonymousToken()
|
||||||
|
};
|
||||||
|
|
||||||
|
scope.Contexts.App.Name = BuildInfo.AppName;
|
||||||
|
scope.Contexts.App.Version = BuildInfo.Version.ToString();
|
||||||
|
scope.Contexts.App.StartTime = _startTime;
|
||||||
|
scope.Contexts.App.Hash = HashUtil.AnonymousToken();
|
||||||
|
scope.Contexts.App.Build = BuildInfo.Release; // Git commit cache?
|
||||||
|
|
||||||
|
scope.SetTag("culture", Thread.CurrentThread.CurrentCulture.Name);
|
||||||
|
scope.SetTag("branch", BuildInfo.Branch);
|
||||||
|
|
||||||
|
if (DatabaseVersion != default(Version))
|
||||||
|
{
|
||||||
|
scope.SetTag("sqlite_version", $"{DatabaseVersion}");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateScope(IOsInfo osInfo)
|
||||||
|
{
|
||||||
|
SentrySdk.ConfigureScope(scope =>
|
||||||
|
{
|
||||||
|
if (osInfo.Name != null && PlatformInfo.IsMono)
|
||||||
|
{
|
||||||
|
// Sentry auto-detection of non-Windows platforms isn't that accurate on certain devices.
|
||||||
|
scope.Contexts.OperatingSystem.Name = osInfo.Name.FirstCharToUpper();
|
||||||
|
scope.Contexts.OperatingSystem.RawDescription = osInfo.FullName;
|
||||||
|
scope.Contexts.OperatingSystem.Version = osInfo.Version.ToString();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnError(Exception ex)
|
private void OnError(Exception ex)
|
||||||
@ -246,27 +287,12 @@ protected override void Write(LogEventInfo logEvent)
|
|||||||
{
|
{
|
||||||
Level = LoggingLevelMap[logEvent.Level],
|
Level = LoggingLevelMap[logEvent.Level],
|
||||||
Logger = logEvent.LoggerName,
|
Logger = logEvent.LoggerName,
|
||||||
Message = logEvent.FormattedMessage,
|
Message = logEvent.FormattedMessage
|
||||||
Environment = UpdateBranch
|
|
||||||
};
|
};
|
||||||
|
|
||||||
sentryEvent.SetExtras(extras);
|
sentryEvent.SetExtras(extras);
|
||||||
sentryEvent.SetFingerprint(fingerPrint);
|
sentryEvent.SetFingerprint(fingerPrint);
|
||||||
|
|
||||||
// this can't be in the constructor as at that point OsInfo won't have
|
|
||||||
// populated these values yet
|
|
||||||
var osName = Environment.GetEnvironmentVariable("OS_NAME");
|
|
||||||
var osVersion = Environment.GetEnvironmentVariable("OS_VERSION");
|
|
||||||
var runTimeVersion = Environment.GetEnvironmentVariable("RUNTIME_VERSION");
|
|
||||||
|
|
||||||
sentryEvent.SetTag("os_name", osName);
|
|
||||||
sentryEvent.SetTag("os_version", $"{osName} {osVersion}");
|
|
||||||
sentryEvent.SetTag("runtime_version", $"{PlatformInfo.PlatformName} {runTimeVersion}");
|
|
||||||
if (DatabaseVersion != default(Version))
|
|
||||||
{
|
|
||||||
sentryEvent.SetTag("sqlite_version", $"{DatabaseVersion}");
|
|
||||||
}
|
|
||||||
|
|
||||||
SentrySdk.CaptureEvent(sentryEvent);
|
SentrySdk.CaptureEvent(sentryEvent);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -363,11 +363,6 @@ public void HandleAsync(ApplicationStartedEvent message)
|
|||||||
{
|
{
|
||||||
EnsureDefaultConfigFile();
|
EnsureDefaultConfigFile();
|
||||||
DeleteOldValues();
|
DeleteOldValues();
|
||||||
|
|
||||||
if (!AnalyticsEnabled)
|
|
||||||
{
|
|
||||||
NzbDroneLogger.UnRegisterRemoteLoggers();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Execute(ResetApiKeyCommand message)
|
public void Execute(ResetApiKeyCommand message)
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NLog.Config;
|
using NLog.Config;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
|
using NzbDrone.Common.Instrumentation.Sentry;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Configuration.Events;
|
using NzbDrone.Core.Configuration.Events;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
@ -40,6 +42,9 @@ public void Reconfigure()
|
|||||||
SetMinimumLogLevel(rules, "appFileDebug", minimumLogLevel <= LogLevel.Debug ? LogLevel.Debug : LogLevel.Off);
|
SetMinimumLogLevel(rules, "appFileDebug", minimumLogLevel <= LogLevel.Debug ? LogLevel.Debug : LogLevel.Off);
|
||||||
SetMinimumLogLevel(rules, "appFileTrace", minimumLogLevel <= LogLevel.Trace ? LogLevel.Trace : LogLevel.Off);
|
SetMinimumLogLevel(rules, "appFileTrace", minimumLogLevel <= LogLevel.Trace ? LogLevel.Trace : LogLevel.Off);
|
||||||
|
|
||||||
|
//Sentry
|
||||||
|
ReconfigureSentry();
|
||||||
|
|
||||||
LogManager.ReconfigExistingLoggers();
|
LogManager.ReconfigExistingLoggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,6 +72,15 @@ private void SetMinimumLogLevel(LoggingRule rule, LogLevel minimumLogLevel)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ReconfigureSentry()
|
||||||
|
{
|
||||||
|
var sentryTarget = LogManager.Configuration.AllTargets.OfType<SentryTarget>().FirstOrDefault();
|
||||||
|
if (sentryTarget != null)
|
||||||
|
{
|
||||||
|
sentryTarget.SentryEnabled = RuntimeInfo.IsProduction && _configFileProvider.AnalyticsEnabled || RuntimeInfo.IsDevelopment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private List<LogLevel> GetLogLevels()
|
private List<LogLevel> GetLogLevels()
|
||||||
{
|
{
|
||||||
return new List<LogLevel>
|
return new List<LogLevel>
|
||||||
|
@ -247,6 +247,8 @@ private Series GetSeries(ParsedEpisodeInfo parsedEpisodeInfo, int tvdbId, int tv
|
|||||||
{
|
{
|
||||||
_logger.Debug()
|
_logger.Debug()
|
||||||
.Message("Found matching series by TVDB ID {0}, an alias may be need for: {1}", tvdbId, parsedEpisodeInfo.SeriesTitle)
|
.Message("Found matching series by TVDB ID {0}, an alias may be need for: {1}", tvdbId, parsedEpisodeInfo.SeriesTitle)
|
||||||
|
.Property("TvdbId", tvdbId)
|
||||||
|
.Property("ParsedEpisodeInfo", parsedEpisodeInfo)
|
||||||
.WriteSentryWarn("TvdbIdMatch", tvdbId.ToString(), parsedEpisodeInfo.SeriesTitle)
|
.WriteSentryWarn("TvdbIdMatch", tvdbId.ToString(), parsedEpisodeInfo.SeriesTitle)
|
||||||
.Write();
|
.Write();
|
||||||
|
|
||||||
@ -256,8 +258,10 @@ private Series GetSeries(ParsedEpisodeInfo parsedEpisodeInfo, int tvdbId, int tv
|
|||||||
if (tvRageId > 0 && tvRageId == searchCriteria.Series.TvRageId)
|
if (tvRageId > 0 && tvRageId == searchCriteria.Series.TvRageId)
|
||||||
{
|
{
|
||||||
_logger.Debug()
|
_logger.Debug()
|
||||||
.Message("Found matching series by TVRage ID {0}, an alias may be need for: {1}", tvdbId, parsedEpisodeInfo.SeriesTitle)
|
.Message("Found matching series by TVRage ID {0}, an alias may be need for: {1}", tvRageId, parsedEpisodeInfo.SeriesTitle)
|
||||||
.WriteSentryWarn("TvRageIdMatch", tvdbId.ToString(), parsedEpisodeInfo.SeriesTitle)
|
.Property("TvRageId", tvRageId)
|
||||||
|
.Property("ParsedEpisodeInfo", parsedEpisodeInfo)
|
||||||
|
.WriteSentryWarn("TvRageIdMatch", tvRageId.ToString(), parsedEpisodeInfo.SeriesTitle)
|
||||||
.Write();
|
.Write();
|
||||||
|
|
||||||
return searchCriteria.Series;
|
return searchCriteria.Series;
|
||||||
@ -279,6 +283,8 @@ private Series GetSeries(ParsedEpisodeInfo parsedEpisodeInfo, int tvdbId, int tv
|
|||||||
{
|
{
|
||||||
_logger.Debug()
|
_logger.Debug()
|
||||||
.Message("Found matching series by TVDB ID {0}, an alias may be need for: {1}", tvdbId, parsedEpisodeInfo.SeriesTitle)
|
.Message("Found matching series by TVDB ID {0}, an alias may be need for: {1}", tvdbId, parsedEpisodeInfo.SeriesTitle)
|
||||||
|
.Property("TvdbId", tvdbId)
|
||||||
|
.Property("ParsedEpisodeInfo", parsedEpisodeInfo)
|
||||||
.WriteSentryWarn("TvdbIdMatch", tvdbId.ToString(), parsedEpisodeInfo.SeriesTitle)
|
.WriteSentryWarn("TvdbIdMatch", tvdbId.ToString(), parsedEpisodeInfo.SeriesTitle)
|
||||||
.Write();
|
.Write();
|
||||||
}
|
}
|
||||||
@ -292,7 +298,9 @@ private Series GetSeries(ParsedEpisodeInfo parsedEpisodeInfo, int tvdbId, int tv
|
|||||||
{
|
{
|
||||||
_logger.Debug()
|
_logger.Debug()
|
||||||
.Message("Found matching series by TVRage ID {0}, an alias may be need for: {1}", tvdbId, parsedEpisodeInfo.SeriesTitle)
|
.Message("Found matching series by TVRage ID {0}, an alias may be need for: {1}", tvdbId, parsedEpisodeInfo.SeriesTitle)
|
||||||
.WriteSentryWarn("TvRageIdMatch", tvdbId.ToString(), parsedEpisodeInfo.SeriesTitle)
|
.Property("TvRageId", tvRageId)
|
||||||
|
.Property("ParsedEpisodeInfo", parsedEpisodeInfo)
|
||||||
|
.WriteSentryWarn("TvRageIdMatch", tvRageId.ToString(), parsedEpisodeInfo.SeriesTitle)
|
||||||
.Write();
|
.Write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ public static void Start(StartupContext startupContext, IUserAlert userAlert, Ac
|
|||||||
LongPathSupport.Enable();
|
LongPathSupport.Enable();
|
||||||
|
|
||||||
_container = MainAppContainerBuilder.BuildContainer(startupContext);
|
_container = MainAppContainerBuilder.BuildContainer(startupContext);
|
||||||
|
_container.Resolve<InitializeLogger>().Initialize();
|
||||||
_container.Resolve<IAppFolderFactory>().Register();
|
_container.Resolve<IAppFolderFactory>().Register();
|
||||||
_container.Resolve<IProvidePidFile>().Write();
|
_container.Resolve<IProvidePidFile>().Write();
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ public MonoPlatformInfo(Logger logger)
|
|||||||
if (versionMatch.Success)
|
if (versionMatch.Success)
|
||||||
{
|
{
|
||||||
runTimeVersion = new Version(versionMatch.Groups["version"].Value);
|
runTimeVersion = new Version(versionMatch.Groups["version"].Value);
|
||||||
Environment.SetEnvironmentVariable("RUNTIME_VERSION", runTimeVersion.ToString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public static void Main(string[] args)
|
|||||||
Logger.Info("Starting Sonarr Update Client");
|
Logger.Info("Starting Sonarr Update Client");
|
||||||
|
|
||||||
_container = UpdateContainerBuilder.Build(startupContext);
|
_container = UpdateContainerBuilder.Build(startupContext);
|
||||||
|
_container.Resolve<InitializeLogger>().Initialize();
|
||||||
_container.Resolve<UpdateApp>().Start(args);
|
_container.Resolve<UpdateApp>().Start(args);
|
||||||
|
|
||||||
Logger.Info("Update completed successfully");
|
Logger.Info("Update completed successfully");
|
||||||
|
@ -13,7 +13,6 @@ public DotNetPlatformInfo(Logger logger)
|
|||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
var version = GetFrameworkVersion();
|
var version = GetFrameworkVersion();
|
||||||
Environment.SetEnvironmentVariable("RUNTIME_VERSION", version.ToString());
|
|
||||||
Version = version;
|
Version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user