|
|
|
@ -8,6 +8,7 @@ using System.Threading;
|
|
|
|
|
using NLog;
|
|
|
|
|
using NLog.Common;
|
|
|
|
|
using NLog.Targets;
|
|
|
|
|
using Npgsql;
|
|
|
|
|
using NzbDrone.Common.EnvironmentInfo;
|
|
|
|
|
using NzbDrone.Common.Extensions;
|
|
|
|
|
using Sentry;
|
|
|
|
@ -34,6 +35,14 @@ namespace NzbDrone.Common.Instrumentation.Sentry
|
|
|
|
|
SQLiteErrorCode.Auth
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private static readonly HashSet<string> FilteredPostgresErrorCodes = new HashSet<string>
|
|
|
|
|
{
|
|
|
|
|
PostgresErrorCodes.OutOfMemory,
|
|
|
|
|
PostgresErrorCodes.TooManyConnections,
|
|
|
|
|
PostgresErrorCodes.DiskFull,
|
|
|
|
|
PostgresErrorCodes.ProgramLimitExceeded
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 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>
|
|
|
|
@ -239,6 +248,19 @@ namespace NzbDrone.Common.Instrumentation.Sentry
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var pgEx = logEvent.Exception as PostgresException;
|
|
|
|
|
if (pgEx != null && FilteredPostgresErrorCodes.Contains(pgEx.SqlState))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// We don't care about transient network and timeout errors
|
|
|
|
|
var npgEx = logEvent.Exception as NpgsqlException;
|
|
|
|
|
if (npgEx != null && npgEx.IsTransient)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (FilteredExceptionTypeNames.Contains(logEvent.Exception.GetType().Name))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|