Skip to content

Commit

Permalink
Remove Sentry (#49)
Browse files Browse the repository at this point in the history
* Revert SQLite to allow side by side

* Update Serilog to 3.1.1 and remove Sentry

* fmt

* Revert serilog change
  • Loading branch information
adamhathcock authored Jul 29, 2024
1 parent 1f92335 commit e79716c
Show file tree
Hide file tree
Showing 18 changed files with 121 additions and 356 deletions.
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
<PackageVersion Include="Polly" Version="7.2.3" />
<PackageVersion Include="Polly.Contrib.WaitAndRetry" Version="1.1.1" />
<PackageVersion Include="Polly.Extensions.Http" Version="3.0.0" />
<PackageVersion Include="Sentry" Version="3.33.0" />
<PackageVersion Include="Sentry.Serilog" Version="3.33.0" />
<PackageVersion Include="Serilog" Version="2.12.0" />
<PackageVersion Include="Serilog.Enrichers.ClientInfo" Version="1.3.0" />
<PackageVersion Include="Serilog.Exceptions" Version="8.4.0" />
Expand All @@ -28,6 +26,8 @@
<PackageVersion Include="Glob" Version="1.1.9" />
<PackageVersion Include="SimpleExec" Version="12.0.0" />
<PackageVersion Include="MongoDB.Driver" Version="2.19.2" />
<!-- this was the previous version used -->
<PackageVersion Include="System.Text.Json" Version="5.0.2" />
<GlobalPackageReference Include="PolySharp" Version="1.14.1" />
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<GlobalPackageReference Include="GitVersion.MsBuild" Version="5.12.0" />
Expand Down
15 changes: 15 additions & 0 deletions build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@
const string INTEGRATION = "integration";
const string PACK = "pack";
const string PACK_LOCAL = "pack-local";
const string CLEAN_LOCKS = "clean-locks";

Target(
CLEAN_LOCKS,
() =>
{
foreach (var f in Glob.Files(".", "**/*.lock.json"))
{
Console.WriteLine("Found and will delete: " + f);
File.Delete(f);
}
Console.WriteLine("Running restore now.");
Run("dotnet", "restore .\\Speckle.Sdk.sln");
}
);

Target(
CLEAN,
Expand Down
6 changes: 0 additions & 6 deletions src/Speckle.Core/Logging/SpeckleException.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using GraphQL;
using Sentry;

namespace Speckle.Core.Logging;

public class SpeckleException : Exception
Expand Down
51 changes: 0 additions & 51 deletions src/Speckle.Core/Logging/SpeckleLog.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using Sentry;
using Serilog;
using Serilog.Core;
using Serilog.Events;
Expand Down Expand Up @@ -37,11 +34,6 @@ public sealed class SpeckleLogConfiguration
/// </summary>
public bool LogToFile { get; }

/// <summary>
/// Flag to enable Sentry sink
/// </summary>
public bool LogToSentry { get; }

/// <summary>
/// Flag to enable Seq sink
/// </summary>
Expand All @@ -66,14 +58,12 @@ public sealed class SpeckleLogConfiguration
/// <param name="minimumLevel">Log events bellow this level are silently dropped</param>
/// <param name="logToConsole">Flag to enable console log sink</param>
/// <param name="logToSeq">Flag to enable Seq log sink</param>
/// <param name="logToSentry">Flag to enable Sentry log sink</param>
/// <param name="logToFile">Flag to enable File log sink</param>
/// <param name="enhancedLogContext">Flag to enable enhanced context on every log event</param>
public SpeckleLogConfiguration(
LogEventLevel minimumLevel = LogEventLevel.Debug,
bool logToConsole = true,
bool logToSeq = true,
bool logToSentry = true,
bool logToFile = true,
bool enhancedLogContext = true,
string sentryDns = DEFAULT_SENTRY_DNS
Expand All @@ -82,7 +72,6 @@ public SpeckleLogConfiguration(
MinimumLevel = minimumLevel;
LogToConsole = logToConsole;
LogToSeq = logToSeq;
LogToSentry = logToSentry;
LogToFile = logToFile;
EnhancedLogContext = enhancedLogContext;
SentryDns = sentryDns;
Expand Down Expand Up @@ -139,17 +128,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 @@ -223,35 +201,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
2 changes: 1 addition & 1 deletion src/Speckle.Core/Models/DynamicBaseMemberType.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using ObsoleteAttribute = System.ObsoleteAttribute;

namespace Speckle.Core.Models;

Expand Down
5 changes: 0 additions & 5 deletions src/Speckle.Core/Serialisation/BaseObjectSerializerV2.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Threading;
using Sentry;
using Speckle.Core.Common;
using Speckle.Core.Logging;
using Speckle.Core.Models;
Expand Down
4 changes: 2 additions & 2 deletions src/Speckle.Core/Speckle.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<IsPackable>true</IsPackable>
<PolySharpExcludeGeneratedTypes>System.Runtime.CompilerServices.RequiresLocationAttribute</PolySharpExcludeGeneratedTypes>
<Configurations>Debug;Release;Local</Configurations>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<ItemGroup>
Expand All @@ -25,8 +26,6 @@
<PackageReference Include="Polly" />
<PackageReference Include="Polly.Contrib.WaitAndRetry" />
<PackageReference Include="Polly.Extensions.Http" />
<PackageReference Include="Sentry" />
<PackageReference Include="Sentry.Serilog" />
<PackageReference Include="Serilog" />
<PackageReference Include="Serilog.Enrichers.ClientInfo" />
<PackageReference Include="Serilog.Exceptions" />
Expand All @@ -36,6 +35,7 @@
<PackageReference Include="Speckle.Newtonsoft.Json" />
<PackageReference Include="Microsoft.Data.Sqlite" />
<PackageReference Include="Speckle.DoubleNumerics" />
<PackageReference Include="System.Text.Json" />
</ItemGroup>

</Project>
65 changes: 15 additions & 50 deletions src/Speckle.Core/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,26 +81,6 @@
"resolved": "1.14.1",
"contentHash": "mOOmFYwad3MIOL14VCjj02LljyF1GNw1wP0YVlxtcPvqdxjGGMNdNJJxHptlry3MOd8b40Flm8RPOM8JOlN2sQ=="
},
"Sentry": {
"type": "Direct",
"requested": "[3.33.0, )",
"resolved": "3.33.0",
"contentHash": "8vbD2o6IR2wrRrkSiRbnodWGWUOqIlwYtzpjvPNOb5raJdOf+zxMwfS8f6nx9bmrTTfDj7KrCB8C/5OuicAc8A==",
"dependencies": {
"System.Reflection.Metadata": "5.0.0",
"System.Text.Json": "5.0.2"
}
},
"Sentry.Serilog": {
"type": "Direct",
"requested": "[3.33.0, )",
"resolved": "3.33.0",
"contentHash": "V8BU7QGWg2qLYfNPqtuTBhC1opysny5l+Ifp6J6PhOeAxU0FssR7nYfbJVetrnLIoh2rd3DlJ6hHYYQosQYcUQ==",
"dependencies": {
"Sentry": "3.33.0",
"Serilog": "2.7.1"
}
},
"Serilog": {
"type": "Direct",
"requested": "[2.12.0, )",
Expand Down Expand Up @@ -175,6 +155,21 @@
"resolved": "13.0.2",
"contentHash": "g1BejUZwax5PRfL6xHgLEK23sqHWOgOj9hE7RvfRRlN00AGt8GnPYt8HedSK7UB3HiRW8zCA9Pn0iiYxCK24BA=="
},
"System.Text.Json": {
"type": "Direct",
"requested": "[5.0.2, )",
"resolved": "5.0.2",
"contentHash": "I47dVIGiV6SfAyppphxqupertT/5oZkYLDCX6vC3HpOI4ZLjyoKAreUoem2ie6G0RbRuFrlqz/PcTQjfb2DOfQ==",
"dependencies": {
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
"System.Buffers": "4.5.1",
"System.Memory": "4.5.4",
"System.Numerics.Vectors": "4.5.0",
"System.Runtime.CompilerServices.Unsafe": "5.0.0",
"System.Text.Encodings.Web": "5.0.1",
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
"GraphQL.Client.Abstractions": {
"type": "Transitive",
"resolved": "6.0.0",
Expand Down Expand Up @@ -366,14 +361,6 @@
"resolved": "4.5.1",
"contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg=="
},
"System.Collections.Immutable": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==",
"dependencies": {
"System.Memory": "4.5.4"
}
},
"System.Memory": {
"type": "Transitive",
"resolved": "4.5.4",
Expand All @@ -398,14 +385,6 @@
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
"System.Reflection.Metadata": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "5NecZgXktdGg34rh1OenY1rFNDCI8xSjFr+Z4OU4cU06AQHUdRnIIEeWENu3Wl4YowbzkymAIMvi3WyK9U53pQ==",
"dependencies": {
"System.Collections.Immutable": "5.0.0"
}
},
"System.Reflection.TypeExtensions": {
"type": "Transitive",
"resolved": "4.7.0",
Expand Down Expand Up @@ -442,20 +421,6 @@
"System.Memory": "4.5.4"
}
},
"System.Text.Json": {
"type": "Transitive",
"resolved": "5.0.2",
"contentHash": "I47dVIGiV6SfAyppphxqupertT/5oZkYLDCX6vC3HpOI4ZLjyoKAreUoem2ie6G0RbRuFrlqz/PcTQjfb2DOfQ==",
"dependencies": {
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
"System.Buffers": "4.5.1",
"System.Memory": "4.5.4",
"System.Numerics.Vectors": "4.5.0",
"System.Runtime.CompilerServices.Unsafe": "5.0.0",
"System.Text.Encodings.Web": "5.0.1",
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
"System.Threading.Tasks.Extensions": {
"type": "Transitive",
"resolved": "4.5.4",
Expand Down
1 change: 1 addition & 0 deletions src/Speckle.Objects/Speckle.Objects.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<PackageTags>$(PackageTags), objects</PackageTags>
<PolySharpExcludeGeneratedTypes>System.Runtime.CompilerServices.RequiresLocationAttribute</PolySharpExcludeGeneratedTypes>
<Configurations>Debug;Release;Local</Configurations>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit e79716c

Please sign in to comment.