diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 88d7df5acb..03201daf07 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -120,7 +120,7 @@ jobs: run: dotnet test Sentry-CI-Build-${{ runner.os }}.slnf -c Release --no-build --nologo -l GitHubActions -l "trx;LogFilePrefix=testresults_${{ runner.os }}" --collect "XPlat Code Coverage" - name: Upload code coverage - uses: codecov/codecov-action@5ecb98a3c6b747ed38dc09f787459979aebb39be + uses: codecov/codecov-action@6d798873df2b1b8e5846dba6fb86631229fbcb17 - name: Upload build and test outputs if: failure() diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 29d4bb09ec..4a47a66971 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -35,7 +35,7 @@ jobs: uses: ./.github/actions/environment - name: Initialize CodeQL - uses: github/codeql-action/init@cdcdbb579706841c47f7063dda365e292e5cad7a # pin@v2 + uses: github/codeql-action/init@b7cec7526559c32f1616476ff32d17ba4c59b2d6 # pin@v2 with: languages: csharp @@ -46,6 +46,6 @@ jobs: run: dotnet build Sentry-CI-CodeQL.slnf --no-restore --nologo - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@cdcdbb579706841c47f7063dda365e292e5cad7a # pin@v2 + uses: github/codeql-action/analyze@b7cec7526559c32f1616476ff32d17ba4c59b2d6 # pin@v2 with: category: '/language:csharp' diff --git a/CHANGELOG.md b/CHANGELOG.md index 6210d6b458..fd40cb02dd 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)) + ### Features - The SDK now supports monitor upserting. You can programmatically set up your monitors via the options callback in `SentrySdk.CaptureCheckIn` ([#3330](https://github.com/getsentry/sentry-dotnet/pull/3330)) @@ -10,6 +14,13 @@ - P/Invoke warning for GetWindowThreadProcessId no longer shows when using Sentry in UWP applications ([#3372](https://github.com/getsentry/sentry-dotnet/pull/3372)) +### Dependencies + +- Update Perfview/TraceEvent to v3.1.10 (patched) ([#3382](https://github.com/getsentry/sentry-dotnet/pull/3382)) +- Bump Native SDK from v0.7.2 to v0.7.4 ([#3385](https://github.com/getsentry/sentry-dotnet/pull/3385)) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#074) + - [diff](https://github.com/getsentry/sentry-native/compare/0.7.2...0.7.4) + ## 4.6.2 ### Fixes diff --git a/modules/perfview b/modules/perfview index 3bebe16b1c..5a57f1044d 160000 --- a/modules/perfview +++ b/modules/perfview @@ -1 +1 @@ -Subproject commit 3bebe16b1c13dedf70967f5507768248c13f31a6 +Subproject commit 5a57f1044d94f77b74d984199b2bf2f9869721bf diff --git a/modules/sentry-native b/modules/sentry-native index 0f1d664759..c3c26b1a33 160000 --- a/modules/sentry-native +++ b/modules/sentry-native @@ -1 +1 @@ -Subproject commit 0f1d664759cba187a846a562f9d55f3c62dffaa3 +Subproject commit c3c26b1a335298b90f3c27e4e4fd8abd892a8419 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 IWebHost BuildWebHost(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 IWebHost BuildWebHost(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.Profiling/Sentry.Profiling.csproj b/src/Sentry.Profiling/Sentry.Profiling.csproj index 61e74f870b..5667f68fc6 100644 --- a/src/Sentry.Profiling/Sentry.Profiling.csproj +++ b/src/Sentry.Profiling/Sentry.Profiling.csproj @@ -13,7 +13,7 @@ - + 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 58afeb2492..3d1ebdf26a 100644 --- a/src/Sentry/Internal/Hub.cs +++ b/src/Sentry/Internal/Hub.cs @@ -127,7 +127,9 @@ internal ITransactionTracer StartTransaction( // 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 @@ internal ITransactionTracer StartTransaction( // 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 Dictionary DefaultTags /// 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 Dictionary DefaultTags /// /// /// + [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 60e540a0a8..9b91f4bf4a 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt @@ -659,6 +659,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 60e540a0a8..9b91f4bf4a 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt @@ -659,6 +659,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 bd91056e5b..dad69eafb7 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt @@ -660,6 +660,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 d9796eb20a..e53ef1dadd 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt @@ -657,6 +657,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());