mirror of
https://github.com/Radarr/Radarr
synced 2025-03-15 00:19:49 +00:00
Fixed: More Sentry Filtering
This commit is contained in:
parent
ae9c2dd830
commit
f395117885
6 changed files with 30 additions and 5 deletions
|
@ -1,5 +1,4 @@
|
|||
using NLog;
|
||||
using NLog.Fluent;
|
||||
|
||||
namespace NzbDrone.Common.Instrumentation.Extensions
|
||||
{
|
||||
|
|
|
@ -25,4 +25,4 @@ namespace NzbDrone.Common.Instrumentation
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace NzbDrone.Common.Instrumentation
|
|||
|
||||
private static void RegisterSentry(bool updateClient)
|
||||
{
|
||||
|
||||
string dsn;
|
||||
|
||||
if (updateClient)
|
||||
|
@ -82,7 +83,7 @@ namespace NzbDrone.Common.Instrumentation
|
|||
Layout = "${message}"
|
||||
};
|
||||
|
||||
var loggingRule = new LoggingRule("*", updateClient ? LogLevel.Trace : LogLevel.Warn, target);
|
||||
var loggingRule = new LoggingRule("*", updateClient ? LogLevel.Trace : LogLevel.Debug, target);
|
||||
LogManager.Configuration.AddTarget("sentryTarget", target);
|
||||
LogManager.Configuration.LoggingRules.Add(loggingRule);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Data.SQLite;
|
||||
using NLog;
|
||||
using NLog.Common;
|
||||
using NLog.Targets;
|
||||
|
@ -17,6 +18,21 @@ namespace NzbDrone.Common.Instrumentation.Sentry
|
|||
[Target("Sentry")]
|
||||
public class SentryTarget : TargetWithLayout
|
||||
{
|
||||
// don't report uninformative SQLite exceptions
|
||||
// busy/locked are benign https://forums.sonarr.tv/t/owin-sqlite-error-5-database-is-locked/5423/11
|
||||
// The others will be user configuration problems and silt up Sentry
|
||||
private static readonly HashSet<SQLiteErrorCode> FilteredSQLiteErrors = new HashSet<SQLiteErrorCode> {
|
||||
SQLiteErrorCode.Busy,
|
||||
SQLiteErrorCode.Locked,
|
||||
SQLiteErrorCode.Perm,
|
||||
SQLiteErrorCode.ReadOnly,
|
||||
SQLiteErrorCode.IoErr,
|
||||
SQLiteErrorCode.Corrupt,
|
||||
SQLiteErrorCode.Full,
|
||||
SQLiteErrorCode.CantOpen,
|
||||
SQLiteErrorCode.Auth
|
||||
};
|
||||
|
||||
// use string and not Type so we don't need a reference to the project
|
||||
// where these are defined
|
||||
private static readonly HashSet<string> FilteredExceptionTypeNames = new HashSet<string> {
|
||||
|
@ -218,6 +234,12 @@ namespace NzbDrone.Common.Instrumentation.Sentry
|
|||
{
|
||||
if (FilterEvents)
|
||||
{
|
||||
var sqlEx = logEvent.Exception as SQLiteException;
|
||||
if (sqlEx != null && FilteredSQLiteErrors.Contains(sqlEx.ResultCode))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (FilteredExceptionTypeNames.Contains(logEvent.Exception.GetType().Name))
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Data.SQLite">
|
||||
<HintPath>..\Libraries\Sqlite\System.Data.SQLite.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -208,8 +208,8 @@ namespace NzbDrone.Core.DecisionEngine
|
|||
{
|
||||
e.Data.Add("report", remoteMovie.Release.ToJson());
|
||||
e.Data.Add("parsed", remoteMovie.ParsedMovieInfo.ToJson());
|
||||
_logger.Error(e, "Couldn't evaluate decision on " + remoteMovie.Release.Title + ", with spec: " + spec.GetType().Name);
|
||||
return new Rejection(string.Format("{0}: {1}", spec.GetType().Name, e.Message));//TODO UPDATE SPECS!
|
||||
_logger.Error(e, "Couldn't evaluate decision on {0}, with spec: {1}", remoteMovie.Release.Title, spec.GetType().Name);
|
||||
return new Rejection($"{spec.GetType().Name}: {e.Message}");
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
Loading…
Add table
Reference in a new issue