Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sentry #3590

Merged
merged 3 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Core/Core/Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@
<ItemGroup>
<PackageReference Include="GraphQL.Client" Version="6.0.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="7.0.5" />
<PackageReference Include="Polly" Version="7.2.3" />
<PackageReference Include="Polly.Contrib.WaitAndRetry" Version="1.1.1" />
<PackageReference Include="Polly.Extensions.Http" Version="3.0.0" />
<PackageReference Include="Sentry" Version="3.33.0" />
<PackageReference Include="Sentry.Serilog" Version="3.33.0" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.Enrichers.ClientInfo" Version="1.3.0" />
<PackageReference Include="Serilog.Enrichers.GlobalLogContext" Version="3.0.0" />
Expand All @@ -57,8 +56,8 @@
<PackageReference Include="Serilog.Sinks.Seq" Version="5.2.2" />
<PackageReference Include="SerilogTimings" Version="3.0.1" />
<PackageReference Include="Speckle.Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="7.0.5" />
<PackageReference Include="System.DoubleNumerics" Version="3.1.3" />
<PackageReference Include="System.Text.Json" Version="5.0.2" /> <!-- research has found this is the least offensive version -->
</ItemGroup>

<!-- Ensure-->
Expand Down
7 changes: 3 additions & 4 deletions Core/Core/Logging/SpeckleException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using GraphQL;
using Sentry;
using Speckle.Core.Api;

namespace Speckle.Core.Logging;
Expand All @@ -19,18 +18,18 @@ public SpeckleException(string? message, Exception? inner = null)

#region obsolete
[Obsolete("Use any other constructor", true)]
public SpeckleException(string? message, Exception? inner, bool log = true, SentryLevel level = SentryLevel.Info)
public SpeckleException(string? message, Exception? inner, bool log = true)
: base(message, inner) { }

[Obsolete($"Use {nameof(SpeckleGraphQLException)} instead", true)]
public SpeckleException(string? message, GraphQLError[] errors, bool log = true, SentryLevel level = SentryLevel.Info)
public SpeckleException(string? message, GraphQLError[] errors, bool log = true)
: base(message)
{
GraphQLErrors = errors.Select(error => new KeyValuePair<string, object>("error", error.Message)).ToList();
}

[Obsolete("Use any other constructor", true)]
public SpeckleException(string message, bool log, SentryLevel level = SentryLevel.Info)
public SpeckleException(string message, bool log)
: base(message) { }

[Obsolete($"Use {nameof(SpeckleGraphQLException)} instead", true)]
Expand Down
41 changes: 0 additions & 41 deletions Core/Core/Logging/SpeckleLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using Sentry;
using Serilog;
using Serilog.Core;
using Serilog.Events;
Expand Down Expand Up @@ -138,17 +137,6 @@ public static void Initialize(
var id = GetUserIdFromDefaultAccount();
s_logger = s_logger.ForContext("id", id).ForContext("isMachineId", s_isMachineIdUsed);

// Configure scope after logger created.
SentrySdk.ConfigureScope(scope =>
{
scope.User = new User { Id = id };
});

SentrySdk.ConfigureScope(scope =>
{
scope.SetTag("hostApplication", hostApplicationName);
});

Logger
.ForContext("userApplicationDataPath", SpecklePathProvider.UserApplicationDataPath())
.ForContext("installApplicationDataPath", SpecklePathProvider.InstallApplicationDataPath)
Expand Down Expand Up @@ -222,35 +210,6 @@ SpeckleLogConfiguration logConfiguration
);
}

if (logConfiguration.LogToSentry)
{
const string ENV =
#if DEBUG
"dev";
#else
"production";
#endif

serilogLogConfiguration = serilogLogConfiguration.WriteTo.Sentry(o =>
{
o.Dsn = logConfiguration.SentryDns;
o.Debug = false;
o.Environment = ENV;
o.Release = "SpeckleCore@" + Assembly.GetExecutingAssembly().GetName().Version;
o.AttachStacktrace = true;
o.StackTraceMode = StackTraceMode.Enhanced;
// Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
o.TracesSampleRate = 1.0;
// Enable Global Mode if running in a client app
o.IsGlobalModeEnabled = true;
// Debug and higher are stored as breadcrumbs (default is Information)
o.MinimumBreadcrumbLevel = LogEventLevel.Debug;
// Warning and higher is sent as event (default is Error)
o.MinimumEventLevel = LogEventLevel.Error;
});
}

var logger = serilogLogConfiguration.CreateLogger();

if (logConfiguration.LogToFile && !canLogToFile)
Expand Down
5 changes: 2 additions & 3 deletions DesktopUI2/DesktopUI2/ConnectorBindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using DesktopUI2.Models.Filters;
using DesktopUI2.Models.Settings;
using DesktopUI2.ViewModels;
using Sentry.Reflection;
using Speckle.Core.Kits;
using Speckle.Core.Models;

Expand All @@ -16,9 +15,9 @@ namespace DesktopUI2;

public abstract class ConnectorBindings
{
public string ConnectorVersion => Assembly.GetAssembly(GetType()).GetNameAndVersion().Version;
public string ConnectorVersion => Assembly.GetAssembly(GetType()).GetName().Version.ToString();

public string ConnectorName => Assembly.GetAssembly(GetType()).GetNameAndVersion().Name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetNameAndVersion() is a Sentry class that uses GetName() which returns AssemblyName internally. This should be the same thing

public string ConnectorName => Assembly.GetAssembly(GetType()).GetName().Name;

//public List<StreamState> SavedStreamStates = new List<StreamState>();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
#if ADVANCESTEEL
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using Autodesk.AdvanceSteel.DocumentManagement;
using Autodesk.AdvanceSteel.DotNetRoots.Units;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Internal.DatabaseServices;
using Objects.Structural.Analysis;
using Sentry;
using Speckle.Core.Kits;
using Speckle.Newtonsoft.Json.Linq;
using static Autodesk.AdvanceSteel.DotNetRoots.Units.Unit;

namespace Objects.Converter.AutocadCivil;
Expand Down