From b0a19968ceb0ec5103f3e1887afe2c865351aca3 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Fri, 24 May 2024 09:46:20 +1200 Subject: [PATCH] Marked EnableTracing as Obsolete (#3381) --- CHANGELOG.md | 4 ++++ .../Sentry.Samples.AspNetCore.Basic/Program.cs | 2 +- .../Program.cs | 2 +- .../Sentry.Samples.AspNetCore.Grpc/Program.cs | 2 +- samples/Sentry.Samples.AspNetCore.Mvc/Program.cs | 2 +- .../Program.cs | 2 +- samples/Sentry.Samples.Console.Basic/Program.cs | 4 ++-- .../Sentry.Samples.Console.Profiling/Program.cs | 2 +- .../Sentry.Samples.EntityFramework/Program.cs | 2 +- .../Program.cs | 1 - samples/Sentry.Samples.GraphQL.Server/Program.cs | 2 +- src/Sentry/BindableSentryOptions.cs | 2 ++ src/Sentry/Internal/Hub.cs | 4 ++++ src/Sentry/Platforms/Android/SentrySdk.cs | 2 ++ src/Sentry/Platforms/Cocoa/SentrySdk.cs | 2 ++ src/Sentry/SentryOptions.cs | 3 +++ .../SentryFunctionsWorkerMiddlewareTests.cs | 2 +- .../SentryLoggingOptionsSetupTests.cs | 6 ++++++ .../SentrySpanProcessorTests.cs | 2 +- .../ApiApprovalTests.Run.DotNet6_0.verified.txt | 1 + .../ApiApprovalTests.Run.DotNet7_0.verified.txt | 1 + .../ApiApprovalTests.Run.DotNet8_0.verified.txt | 1 + .../ApiApprovalTests.Run.Net4_8.verified.txt | 1 + test/Sentry.Tests/HubTests.cs | 14 +++++++++----- test/Sentry.Tests/SentryOptionsTests.cs | 16 ++++++++++++++++ test/Sentry.Tests/SentryOptionsTests.verify.cs | 1 - 26 files changed, 64 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa6c80bef8..8c178da5e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### API Changes + +- SentryOptions.EnableTracing has been marked as Obsolete ([#3381](https://github.com/getsentry/sentry-dotnet/pull/3381)) + ### Fixes - P/Invoke warning for GetWindowThreadProcessId no longer shows when using Sentry in UWP applications ([#3372](https://github.com/getsentry/sentry-dotnet/pull/3372)) diff --git a/samples/Sentry.Samples.AspNetCore.Basic/Program.cs b/samples/Sentry.Samples.AspNetCore.Basic/Program.cs index d982123b56..f892c6ad34 100644 --- a/samples/Sentry.Samples.AspNetCore.Basic/Program.cs +++ b/samples/Sentry.Samples.AspNetCore.Basic/Program.cs @@ -18,7 +18,7 @@ public static void Main(string[] args) o.Dsn = "https://eb18e953812b41c3aeb042e666fd3b5c@o447951.ingest.sentry.io/5428537"; // Enable Sentry performance monitoring - o.EnableTracing = true; + o.TracesSampleRate = 1.0; #if DEBUG // Log debug information about the Sentry SDK diff --git a/samples/Sentry.Samples.AspNetCore.Blazor.Server/Program.cs b/samples/Sentry.Samples.AspNetCore.Blazor.Server/Program.cs index f9799ddd50..56f7712796 100644 --- a/samples/Sentry.Samples.AspNetCore.Blazor.Server/Program.cs +++ b/samples/Sentry.Samples.AspNetCore.Blazor.Server/Program.cs @@ -7,7 +7,7 @@ builder.WebHost.UseSentry(options => { options.Dsn = "https://eb18e953812b41c3aeb042e666fd3b5c@o447951.ingest.sentry.io/5428537"; - options.EnableTracing = true; + options.TracesSampleRate = 1.0; options.Debug = true; }); diff --git a/samples/Sentry.Samples.AspNetCore.Grpc/Program.cs b/samples/Sentry.Samples.AspNetCore.Grpc/Program.cs index b1d9183cb6..b8b0223932 100644 --- a/samples/Sentry.Samples.AspNetCore.Grpc/Program.cs +++ b/samples/Sentry.Samples.AspNetCore.Grpc/Program.cs @@ -41,7 +41,7 @@ public static void Main(string[] args) options.Release = "e386dfd"; // Could also be any format, such as: 2.0, or however version of your app is - options.EnableTracing = true; + options.TracesSampleRate = 1.0; options.MaxBreadcrumbs = 200; diff --git a/samples/Sentry.Samples.AspNetCore.Mvc/Program.cs b/samples/Sentry.Samples.AspNetCore.Mvc/Program.cs index 977055372b..4d6bc12b5e 100644 --- a/samples/Sentry.Samples.AspNetCore.Mvc/Program.cs +++ b/samples/Sentry.Samples.AspNetCore.Mvc/Program.cs @@ -17,7 +17,7 @@ options.MaxBreadcrumbs = 200; - options.EnableTracing = true; + options.TracesSampleRate = 1.0; // Set a proxy for outgoing HTTP connections options.HttpProxy = null; // new WebProxy("https://localhost:3128"); diff --git a/samples/Sentry.Samples.Azure.Functions.Worker/Program.cs b/samples/Sentry.Samples.Azure.Functions.Worker/Program.cs index 519429bf52..b08a44886c 100644 --- a/samples/Sentry.Samples.Azure.Functions.Worker/Program.cs +++ b/samples/Sentry.Samples.Azure.Functions.Worker/Program.cs @@ -6,7 +6,7 @@ { builder.UseSentry(host, options => { - options.EnableTracing = true; + options.TracesSampleRate = 1.0; // options.Debug = true; }); }) diff --git a/samples/Sentry.Samples.Console.Basic/Program.cs b/samples/Sentry.Samples.Console.Basic/Program.cs index f74f015ce3..37e1b24edd 100644 --- a/samples/Sentry.Samples.Console.Basic/Program.cs +++ b/samples/Sentry.Samples.Console.Basic/Program.cs @@ -32,8 +32,8 @@ // If you are writing a background service of any kind, you should remove this. options.IsGlobalModeEnabled = true; - // This option will enable Sentry's tracing features. You still need to start transactions and spans. - options.EnableTracing = true; + // This option tells Sentry to capture 100% of traces. You still need to start transactions and spans. + options.TracesSampleRate = 1.0; }); // This starts a new transaction and attaches it to the scope. diff --git a/samples/Sentry.Samples.Console.Profiling/Program.cs b/samples/Sentry.Samples.Console.Profiling/Program.cs index 487f302653..ef94176029 100644 --- a/samples/Sentry.Samples.Console.Profiling/Program.cs +++ b/samples/Sentry.Samples.Console.Profiling/Program.cs @@ -15,7 +15,7 @@ private static void Main() options.Debug = true; // options.AutoSessionTracking = true; options.IsGlobalModeEnabled = true; - options.EnableTracing = true; + options.TracesSampleRate = 1.0; // Make sure to reduce the sampling rate in production. options.ProfilesSampleRate = 1.0; diff --git a/samples/Sentry.Samples.EntityFramework/Program.cs b/samples/Sentry.Samples.EntityFramework/Program.cs index 89a43c6756..29493de6d3 100644 --- a/samples/Sentry.Samples.EntityFramework/Program.cs +++ b/samples/Sentry.Samples.EntityFramework/Program.cs @@ -6,7 +6,7 @@ { o.Debug = true; // To see SDK logs on the console o.Dsn = "https://eb18e953812b41c3aeb042e666fd3b5c@o447951.ingest.sentry.io/5428537"; - o.EnableTracing = true; + o.TracesSampleRate = 1.0; // Add the EntityFramework integration to the SentryOptions of your app startup code: o.AddEntityFramework(); diff --git a/samples/Sentry.Samples.GraphQL.Client.Http/Program.cs b/samples/Sentry.Samples.GraphQL.Client.Http/Program.cs index e37c0d41cb..388f5aef64 100644 --- a/samples/Sentry.Samples.GraphQL.Client.Http/Program.cs +++ b/samples/Sentry.Samples.GraphQL.Client.Http/Program.cs @@ -15,7 +15,6 @@ options.CaptureFailedRequests = true; options.SendDefaultPii = true; options.TracesSampleRate = 1.0; - options.EnableTracing = true; }); var transaction = SentrySdk.StartTransaction("Program Main", "function"); diff --git a/samples/Sentry.Samples.GraphQL.Server/Program.cs b/samples/Sentry.Samples.GraphQL.Server/Program.cs index 9a3221e377..0e8e53b0a6 100644 --- a/samples/Sentry.Samples.GraphQL.Server/Program.cs +++ b/samples/Sentry.Samples.GraphQL.Server/Program.cs @@ -43,7 +43,7 @@ public static WebApplication BuildWebApplication(string[] args) { // A DSN is required. You can set it here, or in configuration, or in an environment variable. // o.Dsn = "...Your DSN Here..."; - o.EnableTracing = true; + o.TracesSampleRate = 1.0; o.Debug = true; o.SendDefaultPii = true; o.UseOpenTelemetry(); // <-- Configure Sentry to use OpenTelemetry trace information diff --git a/src/Sentry/BindableSentryOptions.cs b/src/Sentry/BindableSentryOptions.cs index a2c92783d9..4630f053c0 100644 --- a/src/Sentry/BindableSentryOptions.cs +++ b/src/Sentry/BindableSentryOptions.cs @@ -83,7 +83,9 @@ public void ApplyTo(SentryOptions options) options.FailedRequestTargets = FailedRequestTargets?.Select(s => new SubstringOrRegexPattern(s)).ToList() ?? options.FailedRequestTargets; options.InitCacheFlushTimeout = InitCacheFlushTimeout ?? options.InitCacheFlushTimeout; options.DefaultTags = DefaultTags ?? options.DefaultTags; +#pragma warning disable CS0618 // Type or member is obsolete options.EnableTracing = EnableTracing ?? options.EnableTracing; +#pragma warning restore CS0618 // Type or member is obsolete options.TracesSampleRate = TracesSampleRate ?? options.TracesSampleRate; options.ProfilesSampleRate = ProfilesSampleRate ?? options.ProfilesSampleRate; options.TracePropagationTargets = TracePropagationTargets?.Select(s => new SubstringOrRegexPattern(s)).ToList() ?? options.TracePropagationTargets; diff --git a/src/Sentry/Internal/Hub.cs b/src/Sentry/Internal/Hub.cs index 1d3f92ae9d..6a8bf44625 100644 --- a/src/Sentry/Internal/Hub.cs +++ b/src/Sentry/Internal/Hub.cs @@ -127,7 +127,9 @@ public async Task ConfigureScopeAsync(Func configureScope) // Additionally, we will always sample out if tracing is explicitly disabled. // Do not invoke the TracesSampler, evaluate the TracesSampleRate, and override any sampling decision // that may have been already set (i.e.: from a sentry-trace header). +#pragma warning disable CS0618 // Type or member is obsolete if (!IsEnabled || _options.EnableTracing is false) +#pragma warning restore CS0618 // Type or member is obsolete { transaction.IsSampled = false; transaction.SampleRate = 0.0; @@ -152,7 +154,9 @@ public async Task ConfigureScopeAsync(Func configureScope) // Random sampling runs only if the sampling decision hasn't been made already. if (transaction.IsSampled == null) { +#pragma warning disable CS0618 // Type or member is obsolete var sampleRate = _options.TracesSampleRate ?? (_options.EnableTracing is true ? 1.0 : 0.0); +#pragma warning restore CS0618 // Type or member is obsolete transaction.IsSampled = _randomValuesFactory.NextBool(sampleRate); transaction.SampleRate = sampleRate; } diff --git a/src/Sentry/Platforms/Android/SentrySdk.cs b/src/Sentry/Platforms/Android/SentrySdk.cs index d44cde77f3..f018ffdcd1 100644 --- a/src/Sentry/Platforms/Android/SentrySdk.cs +++ b/src/Sentry/Platforms/Android/SentrySdk.cs @@ -117,7 +117,9 @@ private static void InitSentryAndroidSdk(SentryOptions options) // These options we have behind feature flags if (options is { IsPerformanceMonitoringEnabled: true, Native.EnableTracing: true }) { +#pragma warning disable CS0618 // Type or member is obsolete o.EnableTracing = (JavaBoolean?)options.EnableTracing; +#pragma warning restore CS0618 // Type or member is obsolete o.TracesSampleRate = (JavaDouble?)options.TracesSampleRate; if (options.TracesSampler is { } tracesSampler) diff --git a/src/Sentry/Platforms/Cocoa/SentrySdk.cs b/src/Sentry/Platforms/Cocoa/SentrySdk.cs index bca498ade9..ac075af7a6 100644 --- a/src/Sentry/Platforms/Cocoa/SentrySdk.cs +++ b/src/Sentry/Platforms/Cocoa/SentrySdk.cs @@ -75,10 +75,12 @@ private static void InitSentryCocoaSdk(SentryOptions options) // These options we have behind feature flags if (options is { IsPerformanceMonitoringEnabled: true, Native.EnableTracing: true }) { +#pragma warning disable CS0618 // Type or member is obsolete if (options.EnableTracing != null) { nativeOptions.EnableTracing = options.EnableTracing.Value; } +#pragma warning restore CS0618 // Type or member is obsolete nativeOptions.TracesSampleRate = options.TracesSampleRate; diff --git a/src/Sentry/SentryOptions.cs b/src/Sentry/SentryOptions.cs index 8f84885e89..0ff5ca5ed9 100644 --- a/src/Sentry/SentryOptions.cs +++ b/src/Sentry/SentryOptions.cs @@ -753,12 +753,14 @@ public IList FailedRequestTargets /// Indicates whether the performance feature is enabled, via any combination of /// , , or . /// +#pragma warning disable CS0618 // Type or member is obsolete internal bool IsPerformanceMonitoringEnabled => EnableTracing switch { false => false, null => TracesSampler is not null || TracesSampleRate is > 0.0, true => TracesSampler is not null || TracesSampleRate is > 0.0 or null }; +#pragma warning restore CS0618 // Type or member is obsolete /// /// Indicates whether profiling is enabled, via any combination of @@ -795,6 +797,7 @@ public IList FailedRequestTargets /// /// /// + [Obsolete("Use TracesSampleRate or TracesSampler instead")] public bool? EnableTracing { get; set; } private double? _tracesSampleRate; diff --git a/test/Sentry.Azure.Functions.Worker.Tests/SentryFunctionsWorkerMiddlewareTests.cs b/test/Sentry.Azure.Functions.Worker.Tests/SentryFunctionsWorkerMiddlewareTests.cs index 4dc844488f..bfb041e06b 100644 --- a/test/Sentry.Azure.Functions.Worker.Tests/SentryFunctionsWorkerMiddlewareTests.cs +++ b/test/Sentry.Azure.Functions.Worker.Tests/SentryFunctionsWorkerMiddlewareTests.cs @@ -16,7 +16,7 @@ public Fixture() var options = new SentryOptions { Dsn = ValidDsn, - EnableTracing = true, + TracesSampleRate = 1.0, }; var client = Substitute.For(); diff --git a/test/Sentry.Extensions.Logging.Tests/SentryLoggingOptionsSetupTests.cs b/test/Sentry.Extensions.Logging.Tests/SentryLoggingOptionsSetupTests.cs index 4660ec85d0..cb20a8014e 100644 --- a/test/Sentry.Extensions.Logging.Tests/SentryLoggingOptionsSetupTests.cs +++ b/test/Sentry.Extensions.Logging.Tests/SentryLoggingOptionsSetupTests.cs @@ -43,7 +43,9 @@ public void Configure_BindsConfigurationToOptions() FailedRequestTargets = new List { "target1", "target2" }, InitCacheFlushTimeout = TimeSpan.FromSeconds(27), // DefaultTags = Dictionary, +#pragma warning disable CS0618 // Type or member is obsolete EnableTracing = true, +#pragma warning restore CS0618 // Type or member is obsolete TracesSampleRate = 0.8f, TracePropagationTargets = new List { "target3", "target4" }, StackTraceMode = StackTraceMode.Enhanced, @@ -94,7 +96,9 @@ public void Configure_BindsConfigurationToOptions() ["FailedRequestTargets:1"] = expected.FailedRequestTargets.Last().ToString(), ["InitCacheFlushTimeout"] = expected.InitCacheFlushTimeout.ToString(), ["DefaultTags"] = expected.DefaultTags.ToString(), +#pragma warning disable CS0618 // Type or member is obsolete ["EnableTracing"] = expected.EnableTracing.ToString(), +#pragma warning restore CS0618 // Type or member is obsolete ["TracesSampleRate"] = expected.TracesSampleRate.Value.ToString(CultureInfo.InvariantCulture), ["TracePropagationTargets:0"] = expected.TracePropagationTargets.First().ToString(), ["TracePropagationTargets:1"] = expected.TracePropagationTargets.Last().ToString(), @@ -152,7 +156,9 @@ public void Configure_BindsConfigurationToOptions() actual.CaptureFailedRequests.Should().Be(expected.CaptureFailedRequests); actual.FailedRequestTargets.Should().BeEquivalentTo(expected.FailedRequestTargets); actual.InitCacheFlushTimeout.Should().Be(expected.InitCacheFlushTimeout); +#pragma warning disable CS0618 // Type or member is obsolete actual.EnableTracing.Should().Be(expected.EnableTracing); +#pragma warning restore CS0618 // Type or member is obsolete actual.TracesSampleRate.Should().Be(expected.TracesSampleRate); actual.TracePropagationTargets.Should().BeEquivalentTo(expected.TracePropagationTargets); actual.StackTraceMode.Should().Be(expected.StackTraceMode); diff --git a/test/Sentry.OpenTelemetry.Tests/SentrySpanProcessorTests.cs b/test/Sentry.OpenTelemetry.Tests/SentrySpanProcessorTests.cs index 6ab4ec8791..0484b762dd 100644 --- a/test/Sentry.OpenTelemetry.Tests/SentrySpanProcessorTests.cs +++ b/test/Sentry.OpenTelemetry.Tests/SentrySpanProcessorTests.cs @@ -23,7 +23,7 @@ public Fixture() Options = new SentryOptions { Dsn = ValidDsn, - EnableTracing = true, + TracesSampleRate = 1.0, AutoSessionTracking = false }; diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt index 98872b7e91..60086c3eae 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt @@ -647,6 +647,7 @@ namespace Sentry public string? Dsn { get; set; } public bool EnableScopeSync { get; set; } public bool EnableSpotlight { get; set; } + [System.Obsolete("Use TracesSampleRate or TracesSampler instead")] public bool? EnableTracing { get; set; } public string? Environment { get; set; } public Sentry.ExperimentalMetricsOptions? ExperimentalMetrics { get; set; } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt index 98872b7e91..60086c3eae 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt @@ -647,6 +647,7 @@ namespace Sentry public string? Dsn { get; set; } public bool EnableScopeSync { get; set; } public bool EnableSpotlight { get; set; } + [System.Obsolete("Use TracesSampleRate or TracesSampler instead")] public bool? EnableTracing { get; set; } public string? Environment { get; set; } public Sentry.ExperimentalMetricsOptions? ExperimentalMetrics { get; set; } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt index eb1c8a26b8..1d68d8de5b 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt @@ -648,6 +648,7 @@ namespace Sentry public string? Dsn { get; set; } public bool EnableScopeSync { get; set; } public bool EnableSpotlight { get; set; } + [System.Obsolete("Use TracesSampleRate or TracesSampler instead")] public bool? EnableTracing { get; set; } public string? Environment { get; set; } public Sentry.ExperimentalMetricsOptions? ExperimentalMetrics { get; set; } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt index 7133c8c11a..5dda16e6a4 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt @@ -645,6 +645,7 @@ namespace Sentry public string? Dsn { get; set; } public bool EnableScopeSync { get; set; } public bool EnableSpotlight { get; set; } + [System.Obsolete("Use TracesSampleRate or TracesSampler instead")] public bool? EnableTracing { get; set; } public string? Environment { get; set; } public Sentry.ExperimentalMetricsOptions? ExperimentalMetrics { get; set; } diff --git a/test/Sentry.Tests/HubTests.cs b/test/Sentry.Tests/HubTests.cs index 99d7ef6f38..e7d346ff87 100644 --- a/test/Sentry.Tests/HubTests.cs +++ b/test/Sentry.Tests/HubTests.cs @@ -23,7 +23,7 @@ public Fixture() Options = new SentryOptions { Dsn = ValidDsn, - EnableTracing = true, + TracesSampleRate = 1.0, AutoSessionTracking = false }; @@ -591,7 +591,7 @@ public void StartTransaction_StaticSampling_SampledOut() public void StartTransaction_EnableTracing_SampledIn() { // Arrange - _fixture.Options.EnableTracing = true; + _fixture.Options.TracesSampleRate = 1.0; var hub = _fixture.GetSut(); // Act @@ -606,7 +606,9 @@ public void StartTransaction_DisableTracing_SampledOut() { // Arrange _fixture.Options.TracesSampleRate = 1.0; +#pragma warning disable CS0618 // Type or member is obsolete _fixture.Options.EnableTracing = false; +#pragma warning restore CS0618 // Type or member is obsolete var hub = _fixture.GetSut(); // Act @@ -620,7 +622,7 @@ public void StartTransaction_DisableTracing_SampledOut() public void StartTransaction_SameInstrumenter_SampledIn() { // Arrange - _fixture.Options.EnableTracing = true; + _fixture.Options.TracesSampleRate = 1.0; _fixture.Options.Instrumenter = Instrumenter.Sentry; // The default... making it explicit for this test though var hub = _fixture.GetSut(); @@ -640,7 +642,7 @@ public void StartTransaction_SameInstrumenter_SampledIn() public void StartTransaction_DifferentInstrumenter_SampledIn() { // Arrange - _fixture.Options.EnableTracing = true; + _fixture.Options.TracesSampleRate = 1.0; _fixture.Options.Instrumenter = Instrumenter.OpenTelemetry; var hub = _fixture.GetSut(); @@ -661,7 +663,7 @@ public void StartTransaction_EnableTracing_Sampler_SampledIn() { // Arrange _fixture.Options.TracesSampler = _ => 1.0; - _fixture.Options.EnableTracing = true; + _fixture.Options.TracesSampleRate = 1.0; var hub = _fixture.GetSut(); // Act @@ -676,7 +678,9 @@ public void StartTransaction_DisableTracing_Sampler_SampledOut() { // Arrange _fixture.Options.TracesSampler = _ => 1.0; +#pragma warning disable CS0618 // Type or member is obsolete _fixture.Options.EnableTracing = false; +#pragma warning restore CS0618 // Type or member is obsolete var hub = _fixture.GetSut(); // Act diff --git a/test/Sentry.Tests/SentryOptionsTests.cs b/test/Sentry.Tests/SentryOptionsTests.cs index 2758598f97..2c1167a819 100644 --- a/test/Sentry.Tests/SentryOptionsTests.cs +++ b/test/Sentry.Tests/SentryOptionsTests.cs @@ -36,7 +36,9 @@ public void AttachStackTrace_ByDefault_True() public void EnableTracing_Default_Null() { var sut = new SentryOptions(); +#pragma warning disable CS0618 // Type or member is obsolete Assert.Null(sut.EnableTracing); +#pragma warning restore CS0618 // Type or member is obsolete } [Fact] @@ -65,7 +67,9 @@ public void IsPerformanceMonitoringEnabled_EnableTracing_True() { var sut = new SentryOptions { +#pragma warning disable CS0618 // Type or member is obsolete EnableTracing = true +#pragma warning restore CS0618 // Type or member is obsolete }; Assert.True(sut.IsPerformanceMonitoringEnabled); @@ -76,7 +80,9 @@ public void IsPerformanceMonitoringEnabled_EnableTracing_False() { var sut = new SentryOptions { +#pragma warning disable CS0618 // Type or member is obsolete EnableTracing = false +#pragma warning restore CS0618 // Type or member is obsolete }; Assert.False(sut.IsPerformanceMonitoringEnabled); @@ -139,7 +145,9 @@ public void IsPerformanceMonitoringEnabled_EnableTracing_True_TracesSampleRate_Z var sut = new SentryOptions { +#pragma warning disable CS0618 // Type or member is obsolete EnableTracing = true, +#pragma warning restore CS0618 // Type or member is obsolete TracesSampleRate = 0.0 }; @@ -154,7 +162,9 @@ public void IsPerformanceMonitoringEnabled_EnableTracing_False_TracesSampleRate_ var sut = new SentryOptions { +#pragma warning disable CS0618 // Type or member is obsolete EnableTracing = false, +#pragma warning restore CS0618 // Type or member is obsolete TracesSampleRate = 1.0 }; @@ -169,7 +179,9 @@ public void IsPerformanceMonitoringEnabled_EnableTracing_False_TracesSampler_Pro var sut = new SentryOptions { +#pragma warning disable CS0618 // Type or member is obsolete EnableTracing = false, +#pragma warning restore CS0618 // Type or member is obsolete TracesSampler = _ => null }; @@ -195,7 +207,9 @@ public void IsProfilingEnabled_EnableTracing_True() { var sut = new SentryOptions { +#pragma warning disable CS0618 // Type or member is obsolete EnableTracing = true, +#pragma warning restore CS0618 // Type or member is obsolete ProfilesSampleRate = double.Epsilon }; @@ -207,7 +221,9 @@ public void IsProfilingEnabled_EnableTracing_False() { var sut = new SentryOptions { +#pragma warning disable CS0618 // Type or member is obsolete EnableTracing = false, +#pragma warning restore CS0618 // Type or member is obsolete ProfilesSampleRate = double.Epsilon }; diff --git a/test/Sentry.Tests/SentryOptionsTests.verify.cs b/test/Sentry.Tests/SentryOptionsTests.verify.cs index 46f0bed53c..adebff2725 100644 --- a/test/Sentry.Tests/SentryOptionsTests.verify.cs +++ b/test/Sentry.Tests/SentryOptionsTests.verify.cs @@ -13,7 +13,6 @@ public Task Integrations_default_ones_are_properly_registered() Debug = true, IsGlobalModeEnabled = true, DiagnosticLogger = logger, - EnableTracing = true, TracesSampleRate = 1.0 }; Hub _ = new(options, Substitute.For());