Don't report errors that don't have exceptions

This commit is contained in:
Keivan Beigi 2017-01-05 10:25:50 -08:00
parent 54bc642476
commit 2487e8ed49
1 changed files with 7 additions and 2 deletions

View File

@ -59,7 +59,7 @@ namespace NzbDrone.Common.Instrumentation.Sentry
try try
{ {
// don't report non-critical events without exceptions // don't report non-critical events without exceptions
if (logEvent.Exception == null && logEvent.Level < LogLevel.Warn) if (logEvent.Exception == null)
{ {
return; return;
} }
@ -78,10 +78,15 @@ namespace NzbDrone.Common.Instrumentation.Sentry
{ {
logEvent.Level.ToString(), logEvent.Level.ToString(),
logEvent.LoggerName, logEvent.LoggerName,
logEvent.Exception?.GetType().ToString() logEvent.Message
} }
}; };
if (logEvent.Exception != null)
{
sentryEvent.Fingerprint.Add(logEvent.Exception.GetType().FullName);
}
sentryEvent.Tags.Add("os_name", Environment.GetEnvironmentVariable("OS_NAME")); sentryEvent.Tags.Add("os_name", Environment.GetEnvironmentVariable("OS_NAME"));
sentryEvent.Tags.Add("os_version", Environment.GetEnvironmentVariable("OS_VERSION")); sentryEvent.Tags.Add("os_version", Environment.GetEnvironmentVariable("OS_VERSION"));
sentryEvent.Tags.Add("runtime_version", Environment.GetEnvironmentVariable("RUNTIME_VERSION")); sentryEvent.Tags.Add("runtime_version", Environment.GetEnvironmentVariable("RUNTIME_VERSION"));