From 0a18898e367c89a320b22691e165b50b5e01f66d Mon Sep 17 00:00:00 2001 From: Robin Dadswell <19610103+RobinDadswell@users.noreply.github.com> Date: Mon, 12 Apr 2021 12:19:51 +0100 Subject: [PATCH] Sentry logging exceptions and some trace logging Co-authored-by: Taloth Saldono --- .../Instrumentation/GlobalExceptionHandlers.cs | 6 ++++++ src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs | 6 +++++- .../MediaFiles/MediaInfo/VideoFileInfoReader.cs | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Common/Instrumentation/GlobalExceptionHandlers.cs b/src/NzbDrone.Common/Instrumentation/GlobalExceptionHandlers.cs index 6f778d7de..71adf0708 100644 --- a/src/NzbDrone.Common/Instrumentation/GlobalExceptionHandlers.cs +++ b/src/NzbDrone.Common/Instrumentation/GlobalExceptionHandlers.cs @@ -18,6 +18,12 @@ namespace NzbDrone.Common.Instrumentation { var exception = e.Exception; + if (exception.InnerException is ObjectDisposedException disposedException && disposedException.ObjectName == "System.Net.HttpListenerRequest") + { + // We don't care about web connections + return; + } + Console.WriteLine("Task Error: {0}", exception); Logger.Error(exception, "Task Error"); } diff --git a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs index 11cd1bdf3..8cd74d661 100644 --- a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs +++ b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs @@ -217,7 +217,11 @@ namespace NzbDrone.Common.Instrumentation.Sentry if (ex != null) { fingerPrint.Add(ex.GetType().FullName); - fingerPrint.Add(ex.TargetSite.ToString()); + if (ex.TargetSite != null) + { + fingerPrint.Add(ex.TargetSite.ToString()); + } + if (ex.InnerException != null) { fingerPrint.Add(ex.InnerException.GetType().FullName); diff --git a/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs b/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs index 650d58eeb..0674c953a 100644 --- a/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs +++ b/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs @@ -78,6 +78,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo if (audioRuntime == 0 && videoRuntime == 0 && generalRuntime == 0) { // No runtime, ask mediainfo to scan the whole file + _logger.Trace("No runtime value found, rescanning at 1.0 scan depth"); mediaInfo.Option("ParseSpeed", "1.0"); using (var stream = _diskProvider.OpenReadStream(filename)) @@ -88,6 +89,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo else if (audioChannels > 2 && audioChannelPositions.IsNullOrWhiteSpace()) { // Some files with DTS don't have ChannelPositions unless more of the file is scanned + _logger.Trace("DTS audio without expected channel information, rescanning at 0.3 scan depth"); mediaInfo.Option("ParseSpeed", "0.3"); using (var stream = _diskProvider.OpenReadStream(filename))