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

Removed obsolete options #2841

Merged
merged 3 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ Additionally, we're dropping support for some of the old target frameworks, plea
- Obsolete setter `Sentry.PlatformAbstractions.Runtime.Identifier` has been removed ([2764](https://github.com/getsentry/sentry-dotnet/pull/2764))
- `Sentry.Values<T>` is now internal as it is never exposed in the public API ([#2771](https://github.com/getsentry/sentry-dotnet/pull/2771))
- `TracePropagationTarget` class has been removed, use the `SubstringOrRegexPattern` class instead. ([#2763](https://github.com/getsentry/sentry-dotnet/pull/2763))
- A number of `[Obsolete]` options have been removed ([#2841](https://github.com/getsentry/sentry-dotnet/pull/2841))
- `BeforeSend` - use `SetBeforeSend` instead.
- `BeforeSendTransaction` - use `SetBeforeSendTransaction` instead.
- `BeforeBreadcrumb` - use `SetBeforeBreadcrumb` instead.
- `CreateHttpClientHandler` - use `CreateHttpMessageHandler` instead.
- `ReportAssemblies` - use `ReportAssembliesMode` instead.
- `KeepAggregateException` - This property is no longer used and has no replacement.
- `DisableTaskUnobservedTaskExceptionCapture` method has been renamed to `DisableUnobservedTaskExceptionCapture`.

#### Changed APIs

Expand Down
11 changes: 0 additions & 11 deletions src/Sentry.AspNetCore/SentryAspNetCoreOptionsSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@ public SentryAspNetCoreOptionsSetup(
{
}

/// <summary>
/// Creates a new instance of <see cref="SentryAspNetCoreOptionsSetup"/>.
/// </summary>
[Obsolete("Use constructor with no IHostingEnvironment")]
public SentryAspNetCoreOptionsSetup(
ILoggerProviderConfiguration<SentryAspNetCoreLoggerProvider> providerConfiguration,
IHostingEnvironment hostingEnvironment)
: base(providerConfiguration.Configuration)
{
}

/// <summary>
/// Configures the <see cref="SentryAspNetCoreOptions"/>.
/// </summary>
Expand Down
18 changes: 8 additions & 10 deletions src/Sentry.Serilog/SentrySinkExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static class SentrySinkExtensions
/// <param name="requestBodyCompressionBuffered">Whether the body compression is buffered and the request 'Content-Length' known in advance. <seealso cref="SentryOptions.RequestBodyCompressionBuffered"/></param>
/// <param name="debug">Whether to log diagnostics messages. <seealso cref="SentryOptions.Debug"/></param>
/// <param name="diagnosticLevel">The diagnostics level to be used. <seealso cref="SentryOptions.DiagnosticLevel"/></param>
/// <param name="reportAssemblies">Whether or not to include referenced assemblies in each event sent to sentry. Defaults to <see langword="true"/>. <seealso cref="SentryOptions.ReportAssemblies"/></param>
/// <param name="reportAssembliesMode">What mode to use for reporting referenced assemblies in each event sent to sentry. Defaults to <see cref="Sentry.ReportAssembliesMode.Version"/></param>
/// <param name="deduplicateMode">What modes to use for event automatic de-duplication. <seealso cref="SentryOptions.DeduplicateMode"/></param>
/// <param name="initializeSdk">Whether to initialize this SDK through this integration. <seealso cref="SentrySerilogOptions.InitializeSdk"/></param>
/// <param name="defaultTags">Defaults tags to add to all events. <seealso cref="SentryOptions.DefaultTags"/></param>
Expand Down Expand Up @@ -66,7 +66,7 @@ public static class SentrySinkExtensions
/// "requestBodyCompressionBuffered": false,
/// "debug": false,
/// "diagnosticLevel": "Debug",
/// "reportAssemblies": false,
/// "reportAssembliesMode": ReportAssembliesMode.None,
/// "deduplicateMode": "All",
/// "initializeSdk": true,
/// "defaultTags": {
Expand Down Expand Up @@ -102,7 +102,7 @@ public static LoggerConfiguration Sentry(
bool? requestBodyCompressionBuffered = null,
bool? debug = null,
SentryLevel? diagnosticLevel = null,
bool? reportAssemblies = null,
ReportAssembliesMode? reportAssembliesMode = null,
DeduplicateMode? deduplicateMode = null,
bool? initializeSdk = null,
Dictionary<string, string>? defaultTags = null)
Expand All @@ -128,7 +128,7 @@ public static LoggerConfiguration Sentry(
requestBodyCompressionBuffered,
debug,
diagnosticLevel,
reportAssemblies,
reportAssembliesMode,
deduplicateMode,
initializeSdk,
defaultTags));
Expand Down Expand Up @@ -158,7 +158,7 @@ public static LoggerConfiguration Sentry(
/// <param name="requestBodyCompressionBuffered">Whether the body compression is buffered and the request 'Content-Length' known in advance. <seealso cref="SentryOptions.RequestBodyCompressionBuffered"/></param>
/// <param name="debug">Whether to log diagnostics messages. <seealso cref="SentryOptions.Debug"/></param>
/// <param name="diagnosticLevel">The diagnostics level to be used. <seealso cref="SentryOptions.DiagnosticLevel"/></param>
/// <param name="reportAssemblies">Whether or not to include referenced assemblies in each event sent to sentry. Defaults to <see langword="true"/>. <seealso cref="SentryOptions.ReportAssemblies"/></param>
/// <param name="reportAssembliesMode">What mode to use for reporting referenced assemblies in each event sent to sentry. Defaults to <see cref="Sentry.ReportAssembliesMode.Version"/></param>
/// <param name="deduplicateMode">What modes to use for event automatic de-duplication. <seealso cref="SentryOptions.DeduplicateMode"/></param>
/// <param name="initializeSdk">Whether to initialize this SDK through this integration. <seealso cref="SentrySerilogOptions.InitializeSdk"/></param>
/// <param name="defaultTags">Defaults tags to add to all events. <seealso cref="SentryOptions.DefaultTags"/></param>
Expand All @@ -184,7 +184,7 @@ public static void ConfigureSentrySerilogOptions(
bool? requestBodyCompressionBuffered = null,
bool? debug = null,
SentryLevel? diagnosticLevel = null,
bool? reportAssemblies = null,
ReportAssembliesMode? reportAssembliesMode = null,
DeduplicateMode? deduplicateMode = null,
bool? initializeSdk = null,
Dictionary<string, string>? defaultTags = null)
Expand Down Expand Up @@ -289,11 +289,9 @@ public static void ConfigureSentrySerilogOptions(
sentrySerilogOptions.DiagnosticLevel = diagnosticLevel.Value;
}

if (reportAssemblies.HasValue)
if (reportAssembliesMode.HasValue)
{
#pragma warning disable CS0618 // Type or member is obsolete
sentrySerilogOptions.ReportAssemblies = reportAssemblies.Value;
#pragma warning restore CS0618 // Type or member is obsolete
sentrySerilogOptions.ReportAssembliesMode = reportAssembliesMode.Value;
}

if (deduplicateMode.HasValue)
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry/Platforms/Android/SentryOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public void AddInAppInclude(string prefix){
public bool EnableAndroidSdkTracing { get; set; } = false;

/// <summary>
/// Gets or sets a value that indicates if the <see cref="BeforeSend"/> callback will be invoked for
/// Gets or sets a value that indicates if the <see cref="o:SetBeforeSend"/> callback will be invoked for
Copy link
Collaborator

@vaind vaind Nov 15, 2023

Choose a reason for hiding this comment

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

IMO, It's still "the BeforeSend callback", but it's set with SetBeforeSend.

Suggested change
/// Gets or sets a value that indicates if the <see cref="o:SetBeforeSend"/> callback will be invoked for
/// Gets or sets a value that indicates if the <see cref="o:BeforeSend"/> callback will be invoked for

/// events that originate from the embedded Android SDK. The default value is <c>false</c> (disabled).
/// </summary>
/// <remarks>
Expand Down
79 changes: 0 additions & 79 deletions src/Sentry/SentryOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -409,17 +409,6 @@ internal bool IsSentryRequest(Uri? requestUri)

internal Func<SentryEvent, Hint, SentryEvent?>? BeforeSendInternal => _beforeSend;

/// <summary>
/// Configures a callback to invoke before sending an event to Sentry
/// </summary>
/// <see cref="SetBeforeBreadcrumb(Func{Breadcrumb, Hint, Breadcrumb?})"/>
[Obsolete("This property will be removed in a future version. Use SetBeforeSend instead.")]
public Func<SentryEvent, SentryEvent?>? BeforeSend
{
get => null;
set => _beforeSend = value is null ? null : (e, _) => value(e);
}

/// <summary>
/// Configures a callback function to be invoked before sending an event to Sentry
/// </summary>
Expand Down Expand Up @@ -450,21 +439,6 @@ public void SetBeforeSend(Func<SentryEvent, SentryEvent?> beforeSend)

internal Func<Transaction, Hint, Transaction?>? BeforeSendTransactionInternal => _beforeSendTransaction;

/// <summary>
/// A callback to invoke before sending a transaction to Sentry
/// </summary>
/// <remarks>
/// The return of this transaction will be sent to Sentry. This allows the application
/// a chance to inspect and/or modify the transaction before it's sent. If the transaction
/// should not be sent at all, return null from the callback.
/// </remarks>
[Obsolete("This property will be removed in a future version. Use SetBeforeSendTransaction instead.")]
public Func<Transaction, Transaction?>? BeforeSendTransaction
{
get => null;
set => _beforeSendTransaction = value is null ? null : (e, _) => value(e);
}

/// <summary>
/// Configures a callback to invoke before sending a transaction to Sentry
/// </summary>
Expand All @@ -487,17 +461,6 @@ public void SetBeforeSendTransaction(Func<Transaction, Transaction?> beforeSendT

internal Func<Breadcrumb, Hint, Breadcrumb?>? BeforeBreadcrumbInternal => _beforeBreadcrumb;

/// <summary>
/// Sets a callback function to be invoked when a breadcrumb is about to be stored.
/// </summary>
/// <see cref="SetBeforeBreadcrumb(Func{Breadcrumb, Hint, Breadcrumb?})"/>
[Obsolete("This property will be removed in a future version. Use SetBeforeBreadcrumb instead.")]
public Func<Breadcrumb, Breadcrumb?>? BeforeBreadcrumb
{
get => null;
set => _beforeBreadcrumb = value is null ? null : (e, _) => value(e);
}

/// <summary>
/// Sets a callback function to be invoked when a breadcrumb is about to be stored.
/// </summary>
Expand Down Expand Up @@ -622,26 +585,6 @@ public int MaxCacheItems
/// </summary>
public IWebProxy? HttpProxy { get; set; }

/// <summary>
/// private field to hold the <see cref="CreateHttpClientHandler"/>, since a typecheck or cast won't work here.
/// </summary>
private Func<HttpClientHandler>? _createClientHandler = null;

/// <summary>
/// Creates the inner most <see cref="HttpClientHandler"/>.
/// Deprecated in favor of <see cref="CreateHttpMessageHandler"/>.
/// </summary>
[Obsolete("Use CreateHttpMessageHandler instead")]
public Func<HttpClientHandler>? CreateHttpClientHandler
{
get => _createClientHandler;
set
{
CreateHttpMessageHandler = value;
_createClientHandler = value;
}
}

/// <summary>
/// Creates the inner most <see cref="HttpMessageHandler"/>.
/// </summary>
Expand Down Expand Up @@ -702,17 +645,6 @@ public IDiagnosticLogger? DiagnosticLogger
}
}

/// <summary>
/// Whether or not to include referenced assemblies in each event sent to sentry. Defaults to <see langword="true"/>.
/// </summary>
[Obsolete("Use ReportAssembliesMode instead", error: false)]
public bool ReportAssemblies
{
// Note: note marking this as error to prevent breaking changes, but this is now a wrapper around ReportAssembliesMode
get => ReportAssembliesMode != ReportAssembliesMode.None;
set => ReportAssembliesMode = value ? ReportAssembliesMode.Version : ReportAssembliesMode.None;
}

/// <summary>
/// What mode to use for reporting referenced assemblies in each event sent to sentry. Defaults to <see cref="Sentry.ReportAssembliesMode.Version"/>.
/// </summary>
Expand Down Expand Up @@ -1029,17 +961,6 @@ public StackTraceMode StackTraceMode
/// </summary>
internal Instrumenter Instrumenter { get; set; } = Instrumenter.Sentry;

/// <summary>
/// This property is no longer used. It will be removed in a future version.
/// </summary>
/// <remarks>
/// All exceptions are now sent to Sentry, including <see cref="AggregateException"/>s.
/// The issue grouping rules in Sentry have been updated to accomodate "exception groups",
/// such as <see cref="AggregateException"/> in .NET.
/// </remarks>
[Obsolete("This property is no longer used. It will be removed in a future version.")]
public bool KeepAggregateException { get; set; }

/// <summary>
/// Adds a <see cref="JsonConverter"/> to be used when serializing or deserializing
/// objects to JSON with this SDK. For example, when custom context data might use
Expand Down
8 changes: 0 additions & 8 deletions src/Sentry/SentryOptionsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ public static void DisableDiagnosticSourceIntegration(this SentryOptions options
=> options.RemoveDefaultIntegration(SentryOptions.DefaultIntegrations.SentryDiagnosticListenerIntegration);
#endif

/// <summary>
/// Disables the capture of errors through <see cref="TaskScheduler.UnobservedTaskException"/>.
/// </summary>
/// <param name="options">The SentryOptions to remove the integration from.</param>
[Obsolete("Method has been renamed to DisableUnobservedTaskExceptionCapture. Please update usage.")]
public static void DisableTaskUnobservedTaskExceptionCapture(this SentryOptions options) =>
options.DisableUnobservedTaskExceptionCapture();

/// <summary>
/// Disables the capture of errors through <see cref="TaskScheduler.UnobservedTaskException"/>.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ namespace Sentry.AspNetCore
public class SentryAspNetCoreOptionsSetup : Microsoft.Extensions.Options.ConfigureFromConfigurationOptions<Sentry.AspNetCore.SentryAspNetCoreOptions>
{
public SentryAspNetCoreOptionsSetup(Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfiguration<Sentry.AspNetCore.SentryAspNetCoreLoggerProvider> providerConfiguration) { }
[System.Obsolete("Use constructor with no IHostingEnvironment")]
public SentryAspNetCoreOptionsSetup(Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfiguration<Sentry.AspNetCore.SentryAspNetCoreLoggerProvider> providerConfiguration, Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment) { }
public override void Configure(Sentry.AspNetCore.SentryAspNetCoreOptions options) { }
}
public static class SentryBuilderExtensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ namespace Sentry.AspNetCore
public class SentryAspNetCoreOptionsSetup : Microsoft.Extensions.Options.ConfigureFromConfigurationOptions<Sentry.AspNetCore.SentryAspNetCoreOptions>
{
public SentryAspNetCoreOptionsSetup(Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfiguration<Sentry.AspNetCore.SentryAspNetCoreLoggerProvider> providerConfiguration) { }
[System.Obsolete("Use constructor with no IHostingEnvironment")]
public SentryAspNetCoreOptionsSetup(Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfiguration<Sentry.AspNetCore.SentryAspNetCoreLoggerProvider> providerConfiguration, Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment) { }
public override void Configure(Sentry.AspNetCore.SentryAspNetCoreOptions options) { }
}
public static class SentryBuilderExtensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ namespace Sentry.AspNetCore
public class SentryAspNetCoreOptionsSetup : Microsoft.Extensions.Options.ConfigureFromConfigurationOptions<Sentry.AspNetCore.SentryAspNetCoreOptions>
{
public SentryAspNetCoreOptionsSetup(Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfiguration<Sentry.AspNetCore.SentryAspNetCoreLoggerProvider> providerConfiguration) { }
[System.Obsolete("Use constructor with no IHostingEnvironment")]
public SentryAspNetCoreOptionsSetup(Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfiguration<Sentry.AspNetCore.SentryAspNetCoreLoggerProvider> providerConfiguration, Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment) { }
public override void Configure(Sentry.AspNetCore.SentryAspNetCoreOptions options) { }
}
public static class SentryBuilderExtensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ namespace Sentry.AspNetCore
public class SentryAspNetCoreOptionsSetup : Microsoft.Extensions.Options.ConfigureFromConfigurationOptions<Sentry.AspNetCore.SentryAspNetCoreOptions>
{
public SentryAspNetCoreOptionsSetup(Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfiguration<Sentry.AspNetCore.SentryAspNetCoreLoggerProvider> providerConfiguration) { }
[System.Obsolete("Use constructor with no IHostingEnvironment")]
public SentryAspNetCoreOptionsSetup(Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfiguration<Sentry.AspNetCore.SentryAspNetCoreLoggerProvider> providerConfiguration, Microsoft.AspNetCore.Hosting.IHostingEnvironment hostingEnvironment) { }
public override void Configure(Sentry.AspNetCore.SentryAspNetCoreOptions options) { }
}
public static class SentryBuilderExtensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Serilog
bool? requestBodyCompressionBuffered = default,
bool? debug = default,
Sentry.SentryLevel? diagnosticLevel = default,
bool? reportAssemblies = default,
Sentry.ReportAssembliesMode? reportAssembliesMode = default,
Sentry.DeduplicateMode? deduplicateMode = default,
bool? initializeSdk = default,
System.Collections.Generic.Dictionary<string, string>? defaultTags = null) { }
Expand All @@ -64,7 +64,7 @@ namespace Serilog
bool? requestBodyCompressionBuffered = default,
bool? debug = default,
Sentry.SentryLevel? diagnosticLevel = default,
bool? reportAssemblies = default,
Sentry.ReportAssembliesMode? reportAssembliesMode = default,
Sentry.DeduplicateMode? deduplicateMode = default,
bool? initializeSdk = default,
System.Collections.Generic.Dictionary<string, string>? defaultTags = null) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Serilog
bool? requestBodyCompressionBuffered = default,
bool? debug = default,
Sentry.SentryLevel? diagnosticLevel = default,
bool? reportAssemblies = default,
Sentry.ReportAssembliesMode? reportAssembliesMode = default,
Sentry.DeduplicateMode? deduplicateMode = default,
bool? initializeSdk = default,
System.Collections.Generic.Dictionary<string, string>? defaultTags = null) { }
Expand All @@ -64,7 +64,7 @@ namespace Serilog
bool? requestBodyCompressionBuffered = default,
bool? debug = default,
Sentry.SentryLevel? diagnosticLevel = default,
bool? reportAssemblies = default,
Sentry.ReportAssembliesMode? reportAssembliesMode = default,
Sentry.DeduplicateMode? deduplicateMode = default,
bool? initializeSdk = default,
System.Collections.Generic.Dictionary<string, string>? defaultTags = null) { }
Expand Down
Loading
Loading