mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Fixed: More Sentry Filtering
This commit is contained in:
parent
ae9c2dd830
commit
f395117885
@ -1,5 +1,4 @@
|
|||||||
using NLog;
|
using NLog;
|
||||||
using NLog.Fluent;
|
|
||||||
|
|
||||||
namespace NzbDrone.Common.Instrumentation.Extensions
|
namespace NzbDrone.Common.Instrumentation.Extensions
|
||||||
{
|
{
|
||||||
|
@ -25,4 +25,4 @@ public void Initialize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,7 @@ public static void Register(IStartupContext startupContext, bool updateApp, bool
|
|||||||
|
|
||||||
private static void RegisterSentry(bool updateClient)
|
private static void RegisterSentry(bool updateClient)
|
||||||
{
|
{
|
||||||
|
|
||||||
string dsn;
|
string dsn;
|
||||||
|
|
||||||
if (updateClient)
|
if (updateClient)
|
||||||
@ -82,7 +83,7 @@ private static void RegisterSentry(bool updateClient)
|
|||||||
Layout = "${message}"
|
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.AddTarget("sentryTarget", target);
|
||||||
LogManager.Configuration.LoggingRules.Add(loggingRule);
|
LogManager.Configuration.LoggingRules.Add(loggingRule);
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
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;
|
||||||
@ -17,6 +18,21 @@ namespace NzbDrone.Common.Instrumentation.Sentry
|
|||||||
[Target("Sentry")]
|
[Target("Sentry")]
|
||||||
public class SentryTarget : TargetWithLayout
|
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
|
// use string and not Type so we don't need a reference to the project
|
||||||
// where these are defined
|
// where these are defined
|
||||||
private static readonly HashSet<string> FilteredExceptionTypeNames = new HashSet<string> {
|
private static readonly HashSet<string> FilteredExceptionTypeNames = new HashSet<string> {
|
||||||
@ -218,6 +234,12 @@ public bool IsSentryMessage(LogEventInfo logEvent)
|
|||||||
{
|
{
|
||||||
if (FilterEvents)
|
if (FilterEvents)
|
||||||
{
|
{
|
||||||
|
var sqlEx = logEvent.Exception as SQLiteException;
|
||||||
|
if (sqlEx != null && FilteredSQLiteErrors.Contains(sqlEx.ResultCode))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (FilteredExceptionTypeNames.Contains(logEvent.Exception.GetType().Name))
|
if (FilteredExceptionTypeNames.Contains(logEvent.Exception.GetType().Name))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System.Configuration.Install" />
|
<Reference Include="System.Configuration.Install" />
|
||||||
|
<Reference Include="System.Data.SQLite">
|
||||||
|
<HintPath>..\Libraries\Sqlite\System.Data.SQLite.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.ServiceProcess" />
|
<Reference Include="System.ServiceProcess" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -208,8 +208,8 @@ private Rejection EvaluateSpec(IDecisionEngineSpecification spec, RemoteMovie re
|
|||||||
{
|
{
|
||||||
e.Data.Add("report", remoteMovie.Release.ToJson());
|
e.Data.Add("report", remoteMovie.Release.ToJson());
|
||||||
e.Data.Add("parsed", remoteMovie.ParsedMovieInfo.ToJson());
|
e.Data.Add("parsed", remoteMovie.ParsedMovieInfo.ToJson());
|
||||||
_logger.Error(e, "Couldn't evaluate decision on " + remoteMovie.Release.Title + ", with spec: " + spec.GetType().Name);
|
_logger.Error(e, "Couldn't evaluate decision on {0}, with spec: {1}", remoteMovie.Release.Title, spec.GetType().Name);
|
||||||
return new Rejection(string.Format("{0}: {1}", spec.GetType().Name, e.Message));//TODO UPDATE SPECS!
|
return new Rejection($"{spec.GetType().Name}: {e.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user