From b1eec16333660a04d8d60060c5b5326d7203e073 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sat, 24 Aug 2019 21:43:45 +0200 Subject: [PATCH] Updated way Sentry gets configured and enabled. --- build.sh | 30 +++--- distribution/debian/control | 2 +- .../Mono/System.Globalization.Extensions.dll | Bin 0 -> 6144 bytes ...ime.InteropServices.RuntimeInformation.dll | Bin 0 -> 7168 bytes .../Mono/System.Text.Encoding.CodePages.dll | Bin 0 -> 5120 bytes .../Mono/System.Threading.Overlapped.dll | Bin 0 -> 4608 bytes src/Libraries/Mono/readme.txt | 3 + src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs | 3 - .../EnvironmentInfo/RuntimeInfo.cs | 52 +++++++--- .../Instrumentation/InitializeLogger.cs | 28 ++++++ .../Instrumentation/NzbDroneLogger.cs | 21 +--- .../Instrumentation/Sentry/SentryTarget.cs | 92 +++++++++++------- .../Configuration/ConfigFileProvider.cs | 5 - .../Instrumentation/ReconfigureLogging.cs | 14 +++ src/NzbDrone.Core/Parser/ParsingService.cs | 14 ++- src/NzbDrone.Host/Bootstrap.cs | 1 + .../EnvironmentInfo/MonoPlatformInfo.cs | 1 - src/NzbDrone.Update/UpdateApp.cs | 2 +- .../EnvironmentInfo/DotNetPlatformInfo.cs | 1 - 19 files changed, 175 insertions(+), 94 deletions(-) create mode 100644 src/Libraries/Mono/System.Globalization.Extensions.dll create mode 100644 src/Libraries/Mono/System.Runtime.InteropServices.RuntimeInformation.dll create mode 100644 src/Libraries/Mono/System.Text.Encoding.CodePages.dll create mode 100644 src/Libraries/Mono/System.Threading.Overlapped.dll create mode 100644 src/Libraries/Mono/readme.txt create mode 100644 src/NzbDrone.Common/Instrumentation/InitializeLogger.cs diff --git a/build.sh b/build.sh index 7043b4fc4..120681108 100755 --- a/build.sh +++ b/build.sh @@ -198,25 +198,25 @@ PackageMono() # 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. - # We have debian dependencies to get these installed - for assembly in System.IO.Compression System.Runtime.InteropServices.RuntimeInformation System.Net.Http + # 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 System.Globalization.Extensions System.Text.Encoding.CodePages System.Threading.Overlapped do - if [ -e $outputFolderLinux/$assembly.dll ] ; then - echo "Remove $assembly.dll (uses win32 interop)" - rm $outputFolderLinux/$assembly.dll - fi - done - - # These assemblies have facades in mono-devel, but we don't have them. - for assembly in System.Globalization.Extensions System.Text.Encoding.CodePages System.Threading.Overlapped - do - if [ -e $outputFolderLinux/$assembly.dll ] ; then - echo "Warn: Facade $assembly.dll (uses win32 interop)" - rm $outputFolderLinux/$assembly.dll - #exit 1 + if [ -e $outputFolderLinux/$assembly.dll ]; then + if [ -e $sourceFolder/Libraries/Mono/$assembly.dll ]; then + echo "Copy Mono-specific facade $assembly.dll (uses win32 interop)" + cp $sourceFolder/Libraries/Mono/$assembly.dll $outputFolderLinux/$assembly.dll + else + echo "Remove $assembly.dll (uses win32 interop)" + rm $outputFolderLinux/$assembly.dll + fi + fi 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" rm $outputFolderLinux/Sonarr.exe* for file in $outputFolderLinux/Sonarr.Console.exe*; do diff --git a/distribution/debian/control b/distribution/debian/control index 598121d3f..26f12532f 100644 --- a/distribution/debian/control +++ b/distribution/debian/control @@ -16,7 +16,7 @@ Architecture: all Provides: nzbdrone Conflicts: 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) Suggests: sqlite3 (>= 3.7), mediainfo (>= 0.7.52) Description: Internet PVR diff --git a/src/Libraries/Mono/System.Globalization.Extensions.dll b/src/Libraries/Mono/System.Globalization.Extensions.dll new file mode 100644 index 0000000000000000000000000000000000000000..8c0861579e934bf6c285d54aea26f14559e2545e GIT binary patch literal 6144 zcmeHLeQ*`k6+gT0^Z(%utQlGczGnmV;~zGr%M2T_;gqicsh z+@GE81YM;}ks4qel9G({_jR}{xWc%I%0yqz_{{?LU$k*h$hr9_{4G}Hzx>@}S%kI& zc6+!J#@cg6Sm3omqD#>|QA@NqEBi8cCFi=(E&+dY!E+&3OS|CTn+k$4u~yG-aH1(h zgCX0o|T62{=yBc{Fs97u5O|fBZ)Il^$x5z$gT6VnX!sA$7 zY0dNonO1tUu!ZS43qA$na8sbVob?1(2CgE*oj7;y4+FJj_O;NrRelIh^0ZDd&(<$j z&j2s`?t*iE*?$*8?yq^s=Wmi{)%fbnPX5WZNm z`Keho!x^D9hgTu=*y=q4Y7K%LU9n8^BFA~KsX5dTYHDa|TmlBMH9&V^VO4jdgM}U7 ze$=&fGvTnt0YG#o?p3!&sT%u^)2wRwt&w)z7lU7ioT^%8STXS2z)H7WA=7qdK9QO@ z-#Bjo7iJSvhZHq9Jrxk1yCjJ1%jblRHgs$^p7WV!BDtZhBFkPN$$4AeELt z{L(v0O!;J;?Zx zL9vXm5oify5^a^rC<<#!;IS;YrLe&q>{pi24%lr4S4{omk4YgZI(|lOlq%^Sc@gNi zuTfg9u>Jez9G2PM8o})bWJ|DiHOJj3$&~iET~deSr>!||g;Yd)JZ`^yi&RV>32qx~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p;-7kJMX7~ zzaN?Zp{udCl(`;}|1Y&kynSYX?OZ>G=u z_2#2JhhF-*V&D7AoqeI-w69zs{Ve$D-Vf$o-x6(oMVb5Z#HXkC?S13jM-p3~Dy};H zgB?4L-Tv{x4_|QS_TKv2f9`o~<#k)GP}zyd@jWk+)V-QP3i={iF^ECxWT4Hm+YO^z)y>RH zU(>`(fk)4M6*fMUkIr&M$e(yJMsD&9F_%exPk>uHE(un-PIjWg8HLpn zWAnx7sSl&7sC`^3vz0Jo<&ghnaXyVgZo`6!S~}U%9--4f* zHerQ7prR=4T-7yH@enPCUtDv!cI&jIz=sgmLg*g&p29DM!aAYJB@Pg~WWSK(MKx+XIT?nrm zX%Twoqn*c^b=i&!yVv8}qMpXYFND}~tg`XpF9LqAqd1~v;?v{#!SUnuXXC|OCdwBJ zhYa4UF`tF}O2HSm0Bxdf$W2^IE}xlKs0*I(u1MjY0E(G)55tZsa@_W8r6A#~Y!-QN z{yd-0hR^51V)0BX>^ZQJ#9lEFAq6}8{4C<<8oi76-~Zc1L_qQWzu9sTZT{cX{|o~E E0%~bA2LJ#7 literal 0 HcmV?d00001 diff --git a/src/Libraries/Mono/System.Runtime.InteropServices.RuntimeInformation.dll b/src/Libraries/Mono/System.Runtime.InteropServices.RuntimeInformation.dll new file mode 100644 index 0000000000000000000000000000000000000000..e55b5eb23a927d37141e2fdb219f16ddcc51d72a GIT binary patch literal 7168 zcmeHL4R9S*6+XNB@|q^;Ym(AZ+ETWZpVu_mBs48eX(9h@AZbEhnufoo`(8H5w)=LU zyZf4i-!LFd9aJnB6%{Lrj;N@}3+rI^QPWd1t~285X*H$Ww&SZwLv^#ZYT9aBPeM&QLxwhIPRTi;=-zgsE=i#)%5Hx% zx7v$zwpuFH5mkay9B?11N2{VXp%Rq~Tn_YR2J0`%Bp~=)6l(e~59NQp4M}F9Y=_() zMw*B=6)`fS>>w%wYai5EJEQA;Np)IvF{~K$rh*BYZ;bn(_g4U*PwX|+8S?G2r3u<=u3WvXe z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=24?$Mg&=JLtq)Ebxo8XW6!(~7j3zYXJ{R*c7|Ymh^rnD$CymeThcjwk zd(LnceuOu{*t8BAvCj!uRTpdV9tQ-@7UJDiBV<@2=SWUTtbfjOZDReD7|B^VZ>JA( zKXtfa^E&kl>v#paG(hvZ=}L5m*aPn=u&IsxS_KyPAa$R@7XXR6p!0~(f+Hh?SYX?a z&?qz{5iKY3REonNE8v+6u(NvXN1frdyw7+n%kd$19iDh9mVOC@XW}kUn3LskLHGGvs-Yk;ZAa;6)WT4WHF~H0I{567k5E Z{vR&5(D*y?!v&e@e|R_lSN#+%@Nc{TN0k5o literal 0 HcmV?d00001 diff --git a/src/Libraries/Mono/System.Text.Encoding.CodePages.dll b/src/Libraries/Mono/System.Text.Encoding.CodePages.dll new file mode 100644 index 0000000000000000000000000000000000000000..414770bc096f591deb3b2473b719e19d3c9d6cbd GIT binary patch literal 5120 zcmeHLeQXrR6@TlGi?M?NQ&MPCx{e94`Pj3~0X8wg#%F>PJGee$JJewI_SWYmd%M@& zJ%3aUalZNysfq&$Nl>dI6+#6SY13ATnueGNxvE-}LK|9?wgM>)G)kIKscJ$?-QSzL zv(K2&R4!5; z6u%@johWYWHC#FF*ilD~$(m|ewkL;m*-2QkVadTwAvtD8bY&{GCsPS_Cj(%(ANYFNGu^i7YO=*kcS2Rkrc@Ckp;?jlh)Zck~EvX3+YPkQw7O1 zLM<|nd2s$H>`BxqxIKAu={UG=($Bz!$GO+BdtGo(%>RY-hB)gIRT8gNMl)y> zJDLOPqXnS(kd0#H3PGy{trN6S(9a2aub`@+2B?n|`0Nj$bLl+jr^zQNR6?^rmkPQ< z(A#M>B=vL`=-uRkhUojCp9jqX9->du8Q{$V%A6sNaoQh53uzuagy4>sdE&?jwx-#R zBuxDdin*HYm`0eQy4T%kxt?liIvMGXhRY|eMs>2(m`*`GoQOu%u&LL1NUm_g)2YsN z^;p;(Y%{#8i8mOg-mW{YVOvw@G+I5j6H`4XRr6y<1$9?*j5v>)Y9grjs0q`n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+wz2@;n|Grf5i}SndKY8NOrR^*BpW5};Ki&4|z=Pjxer3zfZT(Na z9BN;(Z~RAJSoIaR5dR)*7`?1r;QGgT3t($m7~}w6qyxY^sSi{KzO=f*cL28+zPjl9 zWtab3csql|g?@*xh`GX{2sGoH0i*)0Iyul|;G04~r$vKg%So&G;8Q*Qgc z4Xyy^%f5_{UIjLJm}Nkox{jv2oYO$TFHCXJ@D)K<@b21_!B1edhg}HTM$mhZWbjh= zQyRJj_D=dcXz+Om5=UB;MV$(aX=o;Xh#yr?>&;5rM-VAp?!k8Nl{9~#Vf z2z#+jK{TS!>|%sxW@q_+vo<#1Dx2A7Kzie1mms!bSko}w_*0baVmmo54tgEF&UkgR z_B=w((BBE&DXE#Wl0_ca^Aw`O-`MkID%Bx6^{{O{tZk$Xpk_yRCbm46^?1;G4~6g> zmOqX1v+|)qBUc12$mx9a_;zr<*zX`e%yH%1e9ffs*eTSDeQeZG4mNm2(Ix7VnX%zt zP_LXR6%pgJk-`ccSU|!#8iXEQ*0AI2%0a?*hGpJo?=v_1b9290u4#cj7dkRHJti`v l;^cBA%v24pYxEnRulL|xjDTABpK)x{ySV3jTm9ce;D3@i_4EJ$ literal 0 HcmV?d00001 diff --git a/src/Libraries/Mono/readme.txt b/src/Libraries/Mono/readme.txt new file mode 100644 index 000000000..f1251a98f --- /dev/null +++ b/src/Libraries/Mono/readme.txt @@ -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 \ No newline at end of file diff --git a/src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs b/src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs index abe4070c6..cad3d3002 100644 --- a/src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs +++ b/src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs @@ -82,9 +82,6 @@ namespace NzbDrone.Common.EnvironmentInfo Name = Os.ToString(); FullName = Name; } - - Environment.SetEnvironmentVariable("OS_NAME", Name); - Environment.SetEnvironmentVariable("OS_VERSION", Version); } } diff --git a/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs b/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs index b7ea36e5d..febace9af 100644 --- a/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs +++ b/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs @@ -35,7 +35,16 @@ namespace NzbDrone.Common.EnvironmentInfo 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 @@ -104,23 +113,21 @@ namespace NzbDrone.Common.EnvironmentInfo public bool RestartPending { get; set; } public string ExecutingApplication { get; } + public static bool IsTesting { 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 { var lowerProcessName = Process.GetCurrentProcess().ProcessName.ToLower(); - if (lowerProcessName.Contains("vshost")) return false; - if (lowerProcessName.Contains("nunit")) return false; - if (lowerProcessName.Contains("jetbrain")) return false; - if (lowerProcessName.Contains("resharper")) return false; + if (lowerProcessName.Contains("vshost")) return true; + if (lowerProcessName.Contains("nunit")) return true; + if (lowerProcessName.Contains("jetbrain")) return true; + if (lowerProcessName.Contains("resharper")) return true; } catch { @@ -130,7 +137,7 @@ namespace NzbDrone.Common.EnvironmentInfo try { var currentAssemblyLocation = typeof(RuntimeInfo).Assembly.Location; - if (currentAssemblyLocation.ToLower().Contains("_output")) return false; + if (currentAssemblyLocation.ToLower().Contains("_output")) return true; } catch { @@ -138,9 +145,24 @@ namespace NzbDrone.Common.EnvironmentInfo } var lowerCurrentDir = Directory.GetCurrentDirectory().ToLower(); - if (lowerCurrentDir.Contains("teamcity")) return false; - if (lowerCurrentDir.Contains("buildagent")) return false; - if (lowerCurrentDir.Contains("_output")) return false; + if (lowerCurrentDir.Contains("teamcity")) return true; + if (lowerCurrentDir.Contains("buildagent")) return true; + 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; } diff --git a/src/NzbDrone.Common/Instrumentation/InitializeLogger.cs b/src/NzbDrone.Common/Instrumentation/InitializeLogger.cs new file mode 100644 index 000000000..aa7696204 --- /dev/null +++ b/src/NzbDrone.Common/Instrumentation/InitializeLogger.cs @@ -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().FirstOrDefault(); + if (sentryTarget != null) + { + sentryTarget.UpdateScope(_osInfo); + } + } + } +} diff --git a/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs b/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs index bcb01df9b..9830e8ade 100644 --- a/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs +++ b/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs @@ -60,18 +60,6 @@ namespace NzbDrone.Common.Instrumentation 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() { var target = new LogentriesTarget(); @@ -92,15 +80,15 @@ namespace NzbDrone.Common.Instrumentation if (updateClient) { dsn = RuntimeInfo.IsProduction - ? "https://b85aa82c65b84b0e99e3b7c281438357:392b5bc007974147a922c5d841c47cf9@sentry.sonarr.tv/11" - : "https://6168f0946aba4e60ac23e469ac08eac5:bd59e8454ccc454ea27a90cff1f814ca@sentry.sonarr.tv/9"; + ? "https://80777986b95f44a1a90d1eb2f3af1e36@sentry.sonarr.tv/11" + : "https://6168f0946aba4e60ac23e469ac08eac5@sentry.sonarr.tv/9"; } else { dsn = RuntimeInfo.IsProduction - ? "https://a013727b8d224e719894e1e13ff4966b:c95ca1f9ca02418d829db10c2938baf4@sentry.sonarr.tv/8" - : "https://4ee3580e01d8407c96a7430fbc953512:5f2d07227a0b4fde99dea07041a3ff93@sentry.sonarr.tv/10"; + ? "https://e2adcbe52caf46aeaebb6b1dcdfe10a1@sentry.sonarr.tv/8" + : "https://4ee3580e01d8407c96a7430fbc953512@sentry.sonarr.tv/10"; } Target target; @@ -114,6 +102,7 @@ namespace NzbDrone.Common.Instrumentation } 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"); // We still need the logging rules, so use a null target. diff --git a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs index 5866ad8f3..19399c683 100644 --- a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs +++ b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs @@ -1,14 +1,16 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Data.SQLite; using System.Linq; using System.Net; +using System.Reflection; using System.Threading; -using System.Data.SQLite; using NLog; using NLog.Common; using NLog.Targets; using NzbDrone.Common.EnvironmentInfo; +using NzbDrone.Common.Extensions; using Sentry; using Sentry.Protocol; @@ -75,6 +77,7 @@ namespace NzbDrone.Common.Instrumentation.Sentry {LogLevel.Warn, BreadcrumbLevel.Warning}, }; + private readonly DateTime _startTime = DateTime.UtcNow; private readonly IDisposable _sdk; private bool _disposed; @@ -82,10 +85,11 @@ namespace NzbDrone.Common.Instrumentation.Sentry private bool _unauthorized; public bool FilterEvents { get; set; } - public string UpdateBranch { get; set; } public Version DatabaseVersion { get; set; } public int DatabaseMigration { get; set; } + public bool SentryEnabled { get; set; } + public SentryTarget(string dsn) { _sdk = SentrySdk.Init(o => @@ -93,34 +97,71 @@ namespace NzbDrone.Common.Instrumentation.Sentry o.Dsn = new Dsn(dsn); o.AttachStacktrace = true; o.MaxBreadcrumbs = 200; - o.SendDefaultPii = true; + o.SendDefaultPii = false; + o.AttachStacktrace = true; o.Debug = false; o.DiagnosticsLevel = SentryLevel.Debug; 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.BeforeBreadcrumb = x => SentryCleanser.CleanseBreadcrumb(x); + o.Environment = BuildInfo.Branch; }); - SentrySdk.ConfigureScope(scope => - { - 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()); - }); - + InitializeScope(); + _debounce = new SentryDebounce(); // initialize to true and reconfigure later // Otherwise it will default to false and any errors occuring // before config file gets read will not be filtered 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) @@ -246,27 +287,12 @@ namespace NzbDrone.Common.Instrumentation.Sentry { Level = LoggingLevelMap[logEvent.Level], Logger = logEvent.LoggerName, - Message = logEvent.FormattedMessage, - Environment = UpdateBranch + Message = logEvent.FormattedMessage }; sentryEvent.SetExtras(extras); 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); } catch (Exception e) diff --git a/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs b/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs index 3f35ee00c..209c0f7fa 100644 --- a/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs +++ b/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs @@ -363,11 +363,6 @@ namespace NzbDrone.Core.Configuration { EnsureDefaultConfigFile(); DeleteOldValues(); - - if (!AnalyticsEnabled) - { - NzbDroneLogger.UnRegisterRemoteLoggers(); - } } public void Execute(ResetApiKeyCommand message) diff --git a/src/NzbDrone.Core/Instrumentation/ReconfigureLogging.cs b/src/NzbDrone.Core/Instrumentation/ReconfigureLogging.cs index 9c99dfb02..acd25e57e 100644 --- a/src/NzbDrone.Core/Instrumentation/ReconfigureLogging.cs +++ b/src/NzbDrone.Core/Instrumentation/ReconfigureLogging.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using System.Linq; using NLog; using NLog.Config; +using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Extensions; +using NzbDrone.Common.Instrumentation.Sentry; using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration.Events; using NzbDrone.Core.Messaging.Events; @@ -40,6 +42,9 @@ namespace NzbDrone.Core.Instrumentation SetMinimumLogLevel(rules, "appFileDebug", minimumLogLevel <= LogLevel.Debug ? LogLevel.Debug : LogLevel.Off); SetMinimumLogLevel(rules, "appFileTrace", minimumLogLevel <= LogLevel.Trace ? LogLevel.Trace : LogLevel.Off); + //Sentry + ReconfigureSentry(); + LogManager.ReconfigExistingLoggers(); } @@ -67,6 +72,15 @@ namespace NzbDrone.Core.Instrumentation } } + private void ReconfigureSentry() + { + var sentryTarget = LogManager.Configuration.AllTargets.OfType().FirstOrDefault(); + if (sentryTarget != null) + { + sentryTarget.SentryEnabled = RuntimeInfo.IsProduction && _configFileProvider.AnalyticsEnabled || RuntimeInfo.IsDevelopment; + } + } + private List GetLogLevels() { return new List diff --git a/src/NzbDrone.Core/Parser/ParsingService.cs b/src/NzbDrone.Core/Parser/ParsingService.cs index 6d29df534..a7920ec4a 100644 --- a/src/NzbDrone.Core/Parser/ParsingService.cs +++ b/src/NzbDrone.Core/Parser/ParsingService.cs @@ -247,6 +247,8 @@ namespace NzbDrone.Core.Parser { _logger.Debug() .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) .Write(); @@ -256,8 +258,10 @@ namespace NzbDrone.Core.Parser if (tvRageId > 0 && tvRageId == searchCriteria.Series.TvRageId) { _logger.Debug() - .Message("Found matching series by TVRage ID {0}, an alias may be need for: {1}", tvdbId, parsedEpisodeInfo.SeriesTitle) - .WriteSentryWarn("TvRageIdMatch", tvdbId.ToString(), parsedEpisodeInfo.SeriesTitle) + .Message("Found matching series by TVRage ID {0}, an alias may be need for: {1}", tvRageId, parsedEpisodeInfo.SeriesTitle) + .Property("TvRageId", tvRageId) + .Property("ParsedEpisodeInfo", parsedEpisodeInfo) + .WriteSentryWarn("TvRageIdMatch", tvRageId.ToString(), parsedEpisodeInfo.SeriesTitle) .Write(); return searchCriteria.Series; @@ -279,6 +283,8 @@ namespace NzbDrone.Core.Parser { _logger.Debug() .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) .Write(); } @@ -292,7 +298,9 @@ namespace NzbDrone.Core.Parser { _logger.Debug() .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(); } } diff --git a/src/NzbDrone.Host/Bootstrap.cs b/src/NzbDrone.Host/Bootstrap.cs index dc6e50753..c3e3e85f9 100644 --- a/src/NzbDrone.Host/Bootstrap.cs +++ b/src/NzbDrone.Host/Bootstrap.cs @@ -32,6 +32,7 @@ namespace NzbDrone.Host LongPathSupport.Enable(); _container = MainAppContainerBuilder.BuildContainer(startupContext); + _container.Resolve().Initialize(); _container.Resolve().Register(); _container.Resolve().Write(); diff --git a/src/NzbDrone.Mono/EnvironmentInfo/MonoPlatformInfo.cs b/src/NzbDrone.Mono/EnvironmentInfo/MonoPlatformInfo.cs index e883cea94..e85540dfa 100644 --- a/src/NzbDrone.Mono/EnvironmentInfo/MonoPlatformInfo.cs +++ b/src/NzbDrone.Mono/EnvironmentInfo/MonoPlatformInfo.cs @@ -30,7 +30,6 @@ namespace NzbDrone.Mono.EnvironmentInfo if (versionMatch.Success) { runTimeVersion = new Version(versionMatch.Groups["version"].Value); - Environment.SetEnvironmentVariable("RUNTIME_VERSION", runTimeVersion.ToString()); } } } diff --git a/src/NzbDrone.Update/UpdateApp.cs b/src/NzbDrone.Update/UpdateApp.cs index 928bbb865..f72b6b148 100644 --- a/src/NzbDrone.Update/UpdateApp.cs +++ b/src/NzbDrone.Update/UpdateApp.cs @@ -35,7 +35,7 @@ namespace NzbDrone.Update Logger.Info("Starting Sonarr Update Client"); _container = UpdateContainerBuilder.Build(startupContext); - + _container.Resolve().Initialize(); _container.Resolve().Start(args); Logger.Info("Update completed successfully"); diff --git a/src/NzbDrone.Windows/EnvironmentInfo/DotNetPlatformInfo.cs b/src/NzbDrone.Windows/EnvironmentInfo/DotNetPlatformInfo.cs index 561acb3ac..f05cba7bb 100644 --- a/src/NzbDrone.Windows/EnvironmentInfo/DotNetPlatformInfo.cs +++ b/src/NzbDrone.Windows/EnvironmentInfo/DotNetPlatformInfo.cs @@ -13,7 +13,6 @@ namespace NzbDrone.Windows.EnvironmentInfo { _logger = logger; var version = GetFrameworkVersion(); - Environment.SetEnvironmentVariable("RUNTIME_VERSION", version.ToString()); Version = version; }