diff --git a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs index 4b066f15f..12e70c414 100644 --- a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs +++ b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs @@ -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 FilteredPostgresErrorCodes = new HashSet + { + 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 FilteredExceptionTypeNames = new HashSet @@ -250,6 +259,19 @@ namespace NzbDrone.Common.Instrumentation.Sentry isSentry = 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(ex.GetType().Name)) { isSentry = false; diff --git a/src/NzbDrone.Common/Radarr.Common.csproj b/src/NzbDrone.Common/Radarr.Common.csproj index 204e7912f..689d45682 100644 --- a/src/NzbDrone.Common/Radarr.Common.csproj +++ b/src/NzbDrone.Common/Radarr.Common.csproj @@ -10,6 +10,7 @@ +