From a9577ae171a5cadb1fbfbaff132c56ed353e6f11 Mon Sep 17 00:00:00 2001 From: Ilya Siamionau Date: Thu, 25 Jul 2024 15:26:44 +0200 Subject: [PATCH] CM-38440 - Disable Sentry for on-premise installations (#17) --- CHANGELOG.md | 8 +++++++- .../source.extension.vsixmanifest | 2 +- .../source.extension.vsixmanifest | 2 +- .../Cycode.VisualStudio.Extension.Shared/Constants.cs | 4 +++- .../Cycode.VisualStudio.Extension.Shared/CycodePackage.cs | 1 - .../Options/General.cs | 4 ++++ .../Sentry/SentryInit.cs | 6 ++++++ .../source.extension.cs | 2 +- 8 files changed, 23 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32f02ad..0d5b871 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ## [Unreleased] +## [1.1.4] - 2024-07-25 + +- Disable Sentry for on-premise installations + ## [1.1.3] - 2024-07-18 - Fix deserialization errors @@ -32,6 +36,8 @@ The first public release of the extension. +[1.1.4]: https://github.com/cycodehq/visual-studio-extension/releases/tag/v1.1.4 + [1.1.3]: https://github.com/cycodehq/visual-studio-extension/releases/tag/v1.1.3 [1.1.2]: https://github.com/cycodehq/visual-studio-extension/releases/tag/v1.1.2 @@ -44,4 +50,4 @@ The first public release of the extension. [1.0.0]: https://github.com/cycodehq/visual-studio-extension/releases/tag/v1.0.0 -[Unreleased]: https://github.com/cycodehq/visual-studio-extension/compare/v1.1.3...HEAD +[Unreleased]: https://github.com/cycodehq/visual-studio-extension/compare/v1.1.4...HEAD diff --git a/src/extension/Cycode.VisualStudio.Extension.14.0-16.0/source.extension.vsixmanifest b/src/extension/Cycode.VisualStudio.Extension.14.0-16.0/source.extension.vsixmanifest index be1b366..9512cfd 100644 --- a/src/extension/Cycode.VisualStudio.Extension.14.0-16.0/source.extension.vsixmanifest +++ b/src/extension/Cycode.VisualStudio.Extension.14.0-16.0/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + Cycode Cycode for Visual Studio IDE https://github.com/cycodehq/visual-studio-extension diff --git a/src/extension/Cycode.VisualStudio.Extension.17.0/source.extension.vsixmanifest b/src/extension/Cycode.VisualStudio.Extension.17.0/source.extension.vsixmanifest index 6bb45fb..f655f17 100644 --- a/src/extension/Cycode.VisualStudio.Extension.17.0/source.extension.vsixmanifest +++ b/src/extension/Cycode.VisualStudio.Extension.17.0/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + Cycode Cycode for Visual Studio IDE https://github.com/cycodehq/visual-studio-extension diff --git a/src/extension/Cycode.VisualStudio.Extension.Shared/Constants.cs b/src/extension/Cycode.VisualStudio.Extension.Shared/Constants.cs index 4869d5e..787b136 100644 --- a/src/extension/Cycode.VisualStudio.Extension.Shared/Constants.cs +++ b/src/extension/Cycode.VisualStudio.Extension.Shared/Constants.cs @@ -7,7 +7,9 @@ public static class Constants { public static readonly string PluginPath = GetPluginsPath(); public static readonly string DefaultCliPath = GetDefaultCliPath(); - public const string RequiredCliVersion = "1.10.4"; + public const string RequiredCliVersion = "1.10.7"; + + public const string CycodeDomain = "cycode.com"; public const string CliGithubOrg = "cycodehq"; public const string CliGithubRepo = "cycode-cli"; diff --git a/src/extension/Cycode.VisualStudio.Extension.Shared/CycodePackage.cs b/src/extension/Cycode.VisualStudio.Extension.Shared/CycodePackage.cs index eb1f4ee..7a516a5 100644 --- a/src/extension/Cycode.VisualStudio.Extension.Shared/CycodePackage.cs +++ b/src/extension/Cycode.VisualStudio.Extension.Shared/CycodePackage.cs @@ -8,7 +8,6 @@ using Cycode.VisualStudio.Extension.Shared.Services; using Cycode.VisualStudio.Extension.Shared.Services.ErrorList; using Microsoft.Extensions.DependencyInjection; -using Microsoft.VisualStudio.Shell.Interop; namespace Cycode.VisualStudio.Extension.Shared; diff --git a/src/extension/Cycode.VisualStudio.Extension.Shared/Options/General.cs b/src/extension/Cycode.VisualStudio.Extension.Shared/Options/General.cs index 443f420..084d1f8 100644 --- a/src/extension/Cycode.VisualStudio.Extension.Shared/Options/General.cs +++ b/src/extension/Cycode.VisualStudio.Extension.Shared/Options/General.cs @@ -75,4 +75,8 @@ public class General : BaseOptionModel { [DisplayName("Enable Scan on Save")] [DefaultValue(true)] public bool ScanOnSave { get; set; } = true; + + public bool IsOnPremiseInstallation() { + return !CliApiUrl.EndsWith(Constants.CycodeDomain); + } } \ No newline at end of file diff --git a/src/extension/Cycode.VisualStudio.Extension.Shared/Sentry/SentryInit.cs b/src/extension/Cycode.VisualStudio.Extension.Shared/Sentry/SentryInit.cs index a1f71b3..9c0b385 100644 --- a/src/extension/Cycode.VisualStudio.Extension.Shared/Sentry/SentryInit.cs +++ b/src/extension/Cycode.VisualStudio.Extension.Shared/Sentry/SentryInit.cs @@ -8,6 +8,10 @@ private static string GetSentryRelease() { return $"{Constants.AppName}@{Vsix.Version}"; } + private static bool IsSentryDisabled() { + return General.Instance.IsOnPremiseInstallation(); + } + public static void Init() { SentrySdk.Init(options => { options.Dsn = Constants.SentryDsn; @@ -18,6 +22,8 @@ public static void Init() { options.SendDefaultPii = Constants.SentrySendDefaultPii; options.ServerName = ""; + options.SetBeforeSend((sentryEvent, _) => IsSentryDisabled() ? null : sentryEvent); + options.DisableUnobservedTaskExceptionCapture(); options.DisableAppDomainUnhandledExceptionCapture(); options.DisableNetFxInstallationsIntegration(); diff --git a/src/extension/Cycode.VisualStudio.Extension.Shared/source.extension.cs b/src/extension/Cycode.VisualStudio.Extension.Shared/source.extension.cs index a7e079a..0c03362 100644 --- a/src/extension/Cycode.VisualStudio.Extension.Shared/source.extension.cs +++ b/src/extension/Cycode.VisualStudio.Extension.Shared/source.extension.cs @@ -3,5 +3,5 @@ namespace Cycode.VisualStudio.Extension.Shared; internal sealed class Vsix { public const string Name = "Cycode"; public const string Description = "Cycode for Visual Studio IDE"; - public const string Version = "1.1.3"; + public const string Version = "1.1.4"; } \ No newline at end of file