Sentry SDK v3.23.1
Co-authored-by: Bruno Garcia <bruno@Brunos-MacBook-Pro.local>
This commit is contained in:
parent
cb00ce7c0b
commit
de3cb07c57
|
@ -11,29 +11,44 @@ namespace NzbDrone.Common.Instrumentation.Sentry
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sentryEvent.Message = CleanseLogMessage.Cleanse(sentryEvent.Message);
|
if (sentryEvent.Message is not null)
|
||||||
|
{
|
||||||
|
sentryEvent.Message.Formatted = CleanseLogMessage.Cleanse(sentryEvent.Message.Formatted);
|
||||||
|
sentryEvent.Message.Message = CleanseLogMessage.Cleanse(sentryEvent.Message.Message);
|
||||||
|
sentryEvent.Message.Params = sentryEvent.Message.Params?.Select(x => CleanseLogMessage.Cleanse(x switch
|
||||||
|
{
|
||||||
|
string str => str,
|
||||||
|
_ => x.ToString()
|
||||||
|
})).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
if (sentryEvent.Fingerprint != null)
|
if (sentryEvent.Fingerprint.Any())
|
||||||
{
|
{
|
||||||
var fingerprint = sentryEvent.Fingerprint.Select(x => CleanseLogMessage.Cleanse(x)).ToList();
|
var fingerprint = sentryEvent.Fingerprint.Select(x => CleanseLogMessage.Cleanse(x)).ToList();
|
||||||
sentryEvent.SetFingerprint(fingerprint);
|
sentryEvent.SetFingerprint(fingerprint);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sentryEvent.Extra != null)
|
if (sentryEvent.Extra.Any())
|
||||||
{
|
{
|
||||||
var extras = sentryEvent.Extra.ToDictionary(x => x.Key, y => (object)CleanseLogMessage.Cleanse((string)y.Value));
|
var extras = sentryEvent.Extra.ToDictionary(x => x.Key, y => (object)CleanseLogMessage.Cleanse(y.Value as string));
|
||||||
sentryEvent.SetExtras(extras);
|
sentryEvent.SetExtras(extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sentryEvent.SentryExceptions is not null)
|
||||||
|
{
|
||||||
foreach (var exception in sentryEvent.SentryExceptions)
|
foreach (var exception in sentryEvent.SentryExceptions)
|
||||||
{
|
{
|
||||||
exception.Value = CleanseLogMessage.Cleanse(exception.Value);
|
exception.Value = CleanseLogMessage.Cleanse(exception.Value);
|
||||||
|
if (exception.Stacktrace is not null)
|
||||||
|
{
|
||||||
foreach (var frame in exception.Stacktrace.Frames)
|
foreach (var frame in exception.Stacktrace.Frames)
|
||||||
{
|
{
|
||||||
frame.FileName = ShortenPath(frame.FileName);
|
frame.FileName = ShortenPath(frame.FileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,12 +96,9 @@ namespace NzbDrone.Common.Instrumentation.Sentry
|
||||||
{
|
{
|
||||||
_sdk = SentrySdk.Init(o =>
|
_sdk = SentrySdk.Init(o =>
|
||||||
{
|
{
|
||||||
o.Dsn = new Dsn(dsn);
|
o.Dsn = dsn;
|
||||||
o.AttachStacktrace = true;
|
o.AttachStacktrace = true;
|
||||||
o.MaxBreadcrumbs = 200;
|
o.MaxBreadcrumbs = 200;
|
||||||
o.SendDefaultPii = false;
|
|
||||||
o.Debug = false;
|
|
||||||
o.DiagnosticsLevel = SentryLevel.Debug;
|
|
||||||
o.Release = BuildInfo.Release;
|
o.Release = BuildInfo.Release;
|
||||||
o.BeforeSend = x => SentryCleanser.CleanseEvent(x);
|
o.BeforeSend = x => SentryCleanser.CleanseEvent(x);
|
||||||
o.BeforeBreadcrumb = x => SentryCleanser.CleanseBreadcrumb(x);
|
o.BeforeBreadcrumb = x => SentryCleanser.CleanseBreadcrumb(x);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<PackageReference Include="NLog" Version="4.7.14" />
|
<PackageReference Include="NLog" Version="4.7.14" />
|
||||||
<PackageReference Include="NLog.Targets.Syslog" Version="6.0.3" />
|
<PackageReference Include="NLog.Targets.Syslog" Version="6.0.3" />
|
||||||
<PackageReference Include="NLog.Extensions.Logging" Version="1.7.4" />
|
<PackageReference Include="NLog.Extensions.Logging" Version="1.7.4" />
|
||||||
<PackageReference Include="Sentry" Version="2.1.8" />
|
<PackageReference Include="Sentry" Version="3.23.1" />
|
||||||
<PackageReference Include="SharpZipLib" Version="1.3.3" />
|
<PackageReference Include="SharpZipLib" Version="1.3.3" />
|
||||||
<PackageReference Include="System.Text.Json" Version="6.0.4" />
|
<PackageReference Include="System.Text.Json" Version="6.0.4" />
|
||||||
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
||||||
|
|
Loading…
Reference in New Issue