diff --git a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs index 4b066f15f8..12e70c414f 100644 --- a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs +++ b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs @@ -8,6 +8,7 @@ using NLog; using NLog.Common; using NLog.Targets; +using Npgsql; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Extensions; using Sentry; @@ -34,6 +35,14 @@ public class SentryTarget : TargetWithLayout 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 @@ public bool IsSentryMessage(LogEventInfo logEvent) 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 204e7912f6..689d45682c 100644 --- a/src/NzbDrone.Common/Radarr.Common.csproj +++ b/src/NzbDrone.Common/Radarr.Common.csproj @@ -10,6 +10,7 @@ +