From a71164e2c1cda8959606bdd96d84f6cc758db701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Thu, 25 Sep 2025 22:15:31 +0200 Subject: [PATCH 1/6] ref(logs): remove ExperimentalAttribute --- src/Sentry/Extensibility/DisabledHub.cs | 2 -- src/Sentry/Extensibility/HubAdapter.cs | 2 -- src/Sentry/IHub.cs | 2 -- src/Sentry/SentryLog.cs | 21 ------------- src/Sentry/SentryLogLevel.cs | 3 -- src/Sentry/SentryOptions.cs | 2 -- src/Sentry/SentrySdk.cs | 1 - src/Sentry/SentryStructuredLogger.Format.cs | 26 ---------------- src/Sentry/SentryStructuredLogger.cs | 2 -- ...piApprovalTests.Run.DotNet8_0.verified.txt | 30 ------------------- ...piApprovalTests.Run.DotNet9_0.verified.txt | 30 ------------------- 11 files changed, 121 deletions(-) diff --git a/src/Sentry/Extensibility/DisabledHub.cs b/src/Sentry/Extensibility/DisabledHub.cs index ad6165a50a..e835a0edfc 100644 --- a/src/Sentry/Extensibility/DisabledHub.cs +++ b/src/Sentry/Extensibility/DisabledHub.cs @@ -257,8 +257,6 @@ public void CaptureUserFeedback(UserFeedback userFeedback) /// /// Disabled Logger. - /// This API is experimental and it may change in the future. /// - [Experimental(Infrastructure.DiagnosticId.ExperimentalFeature)] public SentryStructuredLogger Logger => DisabledSentryStructuredLogger.Instance; } diff --git a/src/Sentry/Extensibility/HubAdapter.cs b/src/Sentry/Extensibility/HubAdapter.cs index 132997cb5f..3f81060c5c 100644 --- a/src/Sentry/Extensibility/HubAdapter.cs +++ b/src/Sentry/Extensibility/HubAdapter.cs @@ -34,9 +34,7 @@ private HubAdapter() { } /// /// Forwards the call to . - /// This API is experimental and it may change in the future. /// - [Experimental(DiagnosticId.ExperimentalFeature)] public SentryStructuredLogger Logger { [DebuggerStepThrough] get => SentrySdk.Experimental.Logger; } /// diff --git a/src/Sentry/IHub.cs b/src/Sentry/IHub.cs index 7232aea817..8c3006c149 100644 --- a/src/Sentry/IHub.cs +++ b/src/Sentry/IHub.cs @@ -19,7 +19,6 @@ public interface IHub : ISentryClient, ISentryScopeManager /// /// Creates and sends logs to Sentry. - /// This API is experimental and it may change in the future. /// /// /// Available options: @@ -28,7 +27,6 @@ public interface IHub : ISentryClient, ISentryScopeManager /// /// /// - [Experimental(Infrastructure.DiagnosticId.ExperimentalFeature)] public SentryStructuredLogger Logger { get; } /// diff --git a/src/Sentry/SentryLog.cs b/src/Sentry/SentryLog.cs index 7e58fec173..ee588d7d75 100644 --- a/src/Sentry/SentryLog.cs +++ b/src/Sentry/SentryLog.cs @@ -1,14 +1,11 @@ using Sentry.Extensibility; -using Sentry.Infrastructure; using Sentry.Protocol; namespace Sentry; /// /// Represents the Sentry Log protocol. -/// This API is experimental and it may change in the future. /// -[Experimental(DiagnosticId.ExperimentalFeature)] [DebuggerDisplay(@"SentryLog \{ Level = {Level}, Message = '{Message}' \}")] public sealed class SentryLog { @@ -27,59 +24,44 @@ internal SentryLog(DateTimeOffset timestamp, SentryId traceId, SentryLogLevel le /// /// The timestamp of the log. - /// This API is experimental and it may change in the future. /// /// /// Sent as seconds since the Unix epoch. /// - [Experimental(DiagnosticId.ExperimentalFeature)] public required DateTimeOffset Timestamp { get; init; } /// /// The trace id of the log. - /// This API is experimental and it may change in the future. /// - [Experimental(DiagnosticId.ExperimentalFeature)] public required SentryId TraceId { get; init; } /// /// The severity level of the log. - /// This API is experimental and it may change in the future. /// - [Experimental(DiagnosticId.ExperimentalFeature)] public required SentryLogLevel Level { get; init; } /// /// The formatted log message. - /// This API is experimental and it may change in the future. /// - [Experimental(DiagnosticId.ExperimentalFeature)] public required string Message { get; init; } /// /// The parameterized template string. - /// This API is experimental and it may change in the future. /// - [Experimental(DiagnosticId.ExperimentalFeature)] public string? Template { get; init; } /// /// The parameters to the template string. - /// This API is experimental and it may change in the future. /// - [Experimental(DiagnosticId.ExperimentalFeature)] public ImmutableArray> Parameters { get; init; } /// /// The span id of the span that was active when the log was collected. - /// This API is experimental and it may change in the future. /// - [Experimental(DiagnosticId.ExperimentalFeature)] public SpanId? ParentSpanId { get; init; } /// /// Gets the attribute value associated with the specified key. - /// This API is experimental and it may change in the future. /// /// /// Returns if the contains an attribute with the specified key and it's value is not . @@ -128,7 +110,6 @@ internal SentryLog(DateTimeOffset timestamp, SentryId traceId, SentryLogLevel le /// /// /// - [Experimental(DiagnosticId.ExperimentalFeature)] public bool TryGetAttribute(string key, [NotNullWhen(true)] out object? value) { if (_attributes.TryGetValue(key, out var attribute) && attribute.Value is not null) @@ -155,9 +136,7 @@ internal bool TryGetAttribute(string key, [NotNullWhen(true)] out string? value) /// /// Set a key-value pair of data attached to the log. - /// This API is experimental and it may change in the future. /// - [Experimental(DiagnosticId.ExperimentalFeature)] public void SetAttribute(string key, object value) { _attributes[key] = new SentryAttribute(value); diff --git a/src/Sentry/SentryLogLevel.cs b/src/Sentry/SentryLogLevel.cs index 9ccde83f0d..f76a617571 100644 --- a/src/Sentry/SentryLogLevel.cs +++ b/src/Sentry/SentryLogLevel.cs @@ -1,11 +1,9 @@ using Sentry.Extensibility; -using Sentry.Infrastructure; namespace Sentry; /// /// The severity of the structured log. -/// This API is experimental and it may change in the future. /// /// /// The named constants use the value of the lowest severity number per severity level: @@ -41,7 +39,6 @@ namespace Sentry; /// /// /// -[Experimental(DiagnosticId.ExperimentalFeature)] public enum SentryLogLevel { /// diff --git a/src/Sentry/SentryOptions.cs b/src/Sentry/SentryOptions.cs index df4e2937e3..913f377968 100644 --- a/src/Sentry/SentryOptions.cs +++ b/src/Sentry/SentryOptions.cs @@ -1864,7 +1864,6 @@ internal static List GetDefaultInAppExclude() => /// /// This and related experimental APIs may change in the future. /// - [Experimental(DiagnosticId.ExperimentalFeature)] public SentryExperimentalOptions Experimental { get; set; } = new(); /// @@ -1873,7 +1872,6 @@ internal static List GetDefaultInAppExclude() => /// /// This and related experimental APIs may change in the future. /// - [Experimental(DiagnosticId.ExperimentalFeature)] public sealed class SentryExperimentalOptions { internal SentryExperimentalOptions() diff --git a/src/Sentry/SentrySdk.cs b/src/Sentry/SentrySdk.cs index eab7b9838f..05c8a394e2 100644 --- a/src/Sentry/SentrySdk.cs +++ b/src/Sentry/SentrySdk.cs @@ -290,7 +290,6 @@ public void Dispose() /// /// This and related experimental APIs may change in the future. /// - [Experimental(DiagnosticId.ExperimentalFeature)] public static class Experimental { /// diff --git a/src/Sentry/SentryStructuredLogger.Format.cs b/src/Sentry/SentryStructuredLogger.Format.cs index 4575b5e0d9..cd7d8a4631 100644 --- a/src/Sentry/SentryStructuredLogger.Format.cs +++ b/src/Sentry/SentryStructuredLogger.Format.cs @@ -1,16 +1,12 @@ -using Sentry.Infrastructure; - namespace Sentry; public abstract partial class SentryStructuredLogger { /// /// Creates and sends a structured log to Sentry, with severity , when enabled and sampled. - /// This API is experimental and it may change in the future. /// /// A formattable . When incompatible with the , the log will not be captured. See System.String.Format. /// The arguments to the . See System.String.Format. - [Experimental(DiagnosticId.ExperimentalFeature)] public void LogTrace(string template, params object[] parameters) { CaptureLog(SentryLogLevel.Trace, template, parameters, null); @@ -18,12 +14,10 @@ public void LogTrace(string template, params object[] parameters) /// /// Creates and sends a structured log to Sentry, with severity , when enabled and sampled. - /// This API is experimental and it may change in the future. /// /// A delegate to set attributes on the . When the delegate throws an during invocation, the log will not be captured. /// A formattable . When incompatible with the , the log will not be captured. See System.String.Format. /// The arguments to the . See System.String.Format. - [Experimental(DiagnosticId.ExperimentalFeature)] public void LogTrace(Action configureLog, string template, params object[] parameters) { CaptureLog(SentryLogLevel.Trace, template, parameters, configureLog); @@ -31,11 +25,9 @@ public void LogTrace(Action configureLog, string template, params obj /// /// Creates and sends a structured log to Sentry, with severity , when enabled and sampled. - /// This API is experimental and it may change in the future. /// /// A formattable . When incompatible with the , the log will not be captured. See System.String.Format. /// The arguments to the . See System.String.Format. - [Experimental(DiagnosticId.ExperimentalFeature)] public void LogDebug(string template, params object[] parameters) { CaptureLog(SentryLogLevel.Debug, template, parameters, null); @@ -43,12 +35,10 @@ public void LogDebug(string template, params object[] parameters) /// /// Creates and sends a structured log to Sentry, with severity , when enabled and sampled. - /// This API is experimental and it may change in the future. /// /// A delegate to set attributes on the . When the delegate throws an during invocation, the log will not be captured. /// A formattable . When incompatible with the , the log will not be captured. See System.String.Format. /// The arguments to the . See System.String.Format. - [Experimental(DiagnosticId.ExperimentalFeature)] public void LogDebug(Action configureLog, string template, params object[] parameters) { CaptureLog(SentryLogLevel.Debug, template, parameters, configureLog); @@ -56,11 +46,9 @@ public void LogDebug(Action configureLog, string template, params obj /// /// Creates and sends a structured log to Sentry, with severity , when enabled and sampled. - /// This API is experimental and it may change in the future. /// /// A formattable . When incompatible with the , the log will not be captured. See System.String.Format. /// The arguments to the . See System.String.Format. - [Experimental(DiagnosticId.ExperimentalFeature)] public void LogInfo(string template, params object[] parameters) { CaptureLog(SentryLogLevel.Info, template, parameters, null); @@ -68,12 +56,10 @@ public void LogInfo(string template, params object[] parameters) /// /// Creates and sends a structured log to Sentry, with severity , when enabled and sampled. - /// This API is experimental and it may change in the future. /// /// A delegate to set attributes on the . When the delegate throws an during invocation, the log will not be captured. /// A formattable . When incompatible with the , the log will not be captured. See System.String.Format. /// The arguments to the . See System.String.Format. - [Experimental(DiagnosticId.ExperimentalFeature)] public void LogInfo(Action configureLog, string template, params object[] parameters) { CaptureLog(SentryLogLevel.Info, template, parameters, configureLog); @@ -81,11 +67,9 @@ public void LogInfo(Action configureLog, string template, params obje /// /// Creates and sends a structured log to Sentry, with severity , when enabled and sampled. - /// This API is experimental and it may change in the future. /// /// A formattable . When incompatible with the , the log will not be captured. See System.String.Format. /// The arguments to the . See System.String.Format. - [Experimental(DiagnosticId.ExperimentalFeature)] public void LogWarning(string template, params object[] parameters) { CaptureLog(SentryLogLevel.Warning, template, parameters, null); @@ -93,12 +77,10 @@ public void LogWarning(string template, params object[] parameters) /// /// Creates and sends a structured log to Sentry, with severity , when enabled and sampled. - /// This API is experimental and it may change in the future. /// /// A delegate to set attributes on the . When the delegate throws an during invocation, the log will not be captured. /// A formattable . When incompatible with the , the log will not be captured. See System.String.Format. /// The arguments to the . See System.String.Format. - [Experimental(DiagnosticId.ExperimentalFeature)] public void LogWarning(Action configureLog, string template, params object[] parameters) { CaptureLog(SentryLogLevel.Warning, template, parameters, configureLog); @@ -106,11 +88,9 @@ public void LogWarning(Action configureLog, string template, params o /// /// Creates and sends a structured log to Sentry, with severity , when enabled and sampled. - /// This API is experimental and it may change in the future. /// /// A formattable . When incompatible with the , the log will not be captured. See System.String.Format. /// The arguments to the . See System.String.Format. - [Experimental(DiagnosticId.ExperimentalFeature)] public void LogError(string template, params object[] parameters) { CaptureLog(SentryLogLevel.Error, template, parameters, null); @@ -118,12 +98,10 @@ public void LogError(string template, params object[] parameters) /// /// Creates and sends a structured log to Sentry, with severity , when enabled and sampled. - /// This API is experimental and it may change in the future. /// /// A delegate to set attributes on the . When the delegate throws an during invocation, the log will not be captured. /// A formattable . When incompatible with the , the log will not be captured. See System.String.Format. /// The arguments to the . See System.String.Format. - [Experimental(DiagnosticId.ExperimentalFeature)] public void LogError(Action configureLog, string template, params object[] parameters) { CaptureLog(SentryLogLevel.Error, template, parameters, configureLog); @@ -131,11 +109,9 @@ public void LogError(Action configureLog, string template, params obj /// /// Creates and sends a structured log to Sentry, with severity , when enabled and sampled. - /// This API is experimental and it may change in the future. /// /// A formattable . When incompatible with the , the log will not be captured. See System.String.Format. /// The arguments to the . See System.String.Format. - [Experimental(DiagnosticId.ExperimentalFeature)] public void LogFatal(string template, params object[] parameters) { CaptureLog(SentryLogLevel.Fatal, template, parameters, null); @@ -143,12 +119,10 @@ public void LogFatal(string template, params object[] parameters) /// /// Creates and sends a structured log to Sentry, with severity , when enabled and sampled. - /// This API is experimental and it may change in the future. /// /// A delegate to set attributes on the . When the delegate throws an during invocation, the log will not be captured. /// A formattable . When incompatible with the , the log will not be captured. See System.String.Format. /// The arguments to the . See System.String.Format. - [Experimental(DiagnosticId.ExperimentalFeature)] public void LogFatal(Action configureLog, string template, params object[] parameters) { CaptureLog(SentryLogLevel.Fatal, template, parameters, configureLog); diff --git a/src/Sentry/SentryStructuredLogger.cs b/src/Sentry/SentryStructuredLogger.cs index 8a0dd9da1b..9d81bd2820 100644 --- a/src/Sentry/SentryStructuredLogger.cs +++ b/src/Sentry/SentryStructuredLogger.cs @@ -5,9 +5,7 @@ namespace Sentry; /// /// Creates and sends logs to Sentry. -/// This API is experimental and it may change in the future. /// -[Experimental(DiagnosticId.ExperimentalFeature)] public abstract partial class SentryStructuredLogger { internal static SentryStructuredLogger Create(IHub hub, SentryOptions options, ISystemClock clock) diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt index 444cbfe027..fbc1d3b7c4 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt @@ -187,7 +187,6 @@ namespace Sentry public interface IHub : Sentry.ISentryClient, Sentry.ISentryScopeManager { Sentry.SentryId LastEventId { get; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] Sentry.SentryStructuredLogger Logger { get; } void BindException(System.Exception exception, Sentry.ISpan span); Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope); @@ -612,35 +611,24 @@ namespace Sentry [System.Runtime.Serialization.EnumMember(Value="fatal")] Fatal = 4, } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] [System.Diagnostics.DebuggerDisplay("SentryLog \\{ Level = {Level}, Message = \'{Message}\' \\}")] [System.Runtime.CompilerServices.RequiredMember] public sealed class SentryLog { - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] [System.Runtime.CompilerServices.RequiredMember] public Sentry.SentryLogLevel Level { get; init; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] [System.Runtime.CompilerServices.RequiredMember] public string Message { get; init; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public System.Collections.Immutable.ImmutableArray> Parameters { get; init; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public Sentry.SpanId? ParentSpanId { get; init; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public string? Template { get; init; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] [System.Runtime.CompilerServices.RequiredMember] public System.DateTimeOffset Timestamp { get; init; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] [System.Runtime.CompilerServices.RequiredMember] public Sentry.SentryId TraceId { get; init; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void SetAttribute(string key, object value) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public bool TryGetAttribute(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out object? value) { } } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public enum SentryLogLevel { Trace = 1, @@ -720,7 +708,6 @@ namespace Sentry public bool EnableScopeSync { get; set; } public bool EnableSpotlight { get; set; } public string? Environment { get; set; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public Sentry.SentryOptions.SentryExperimentalOptions Experimental { get; set; } public System.Collections.Generic.IList FailedRequestStatusCodes { get; set; } public System.Collections.Generic.IList FailedRequestTargets { get; set; } @@ -807,7 +794,6 @@ namespace Sentry public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } public Sentry.SentryOptions UseStackTraceFactory(Sentry.Extensibility.ISentryStackTraceFactory sentryStackTraceFactory) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public sealed class SentryExperimentalOptions { public bool EnableLogs { get; set; } @@ -904,7 +890,6 @@ namespace Sentry public static Sentry.ITransactionTracer StartTransaction(string name, string operation, Sentry.SentryTraceHeader traceHeader) { } public static Sentry.ITransactionTracer StartTransaction(string name, string operation, string? description) { } public static void UnsetTag(string key) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public static class Experimental { public static Sentry.SentryStructuredLogger Logger { get; } @@ -988,34 +973,21 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SentryStackTrace FromJson(System.Text.Json.JsonElement json) { } } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public abstract class SentryStructuredLogger { protected abstract void CaptureLog(Sentry.SentryLog log); protected abstract void Flush(); - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogDebug(string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogDebug(System.Action configureLog, string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogError(string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogError(System.Action configureLog, string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogFatal(string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogFatal(System.Action configureLog, string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogInfo(string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogInfo(System.Action configureLog, string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogTrace(string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogTrace(System.Action configureLog, string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogWarning(string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogWarning(System.Action configureLog, string template, params object[] parameters) { } } public sealed class SentryThread : Sentry.ISentryJsonSerializable @@ -1410,7 +1382,6 @@ namespace Sentry.Extensibility public static readonly Sentry.Extensibility.DisabledHub Instance; public bool IsEnabled { get; } public Sentry.SentryId LastEventId { get; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public Sentry.SentryStructuredLogger Logger { get; } public void BindClient(Sentry.ISentryClient client) { } public void BindException(System.Exception exception, Sentry.ISpan span) { } @@ -1458,7 +1429,6 @@ namespace Sentry.Extensibility public static readonly Sentry.Extensibility.HubAdapter Instance; public bool IsEnabled { get; } public Sentry.SentryId LastEventId { get; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public Sentry.SentryStructuredLogger Logger { get; } public void AddBreadcrumb(string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public void AddBreadcrumb(Sentry.Infrastructure.ISystemClock clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt index 444cbfe027..fbc1d3b7c4 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt @@ -187,7 +187,6 @@ namespace Sentry public interface IHub : Sentry.ISentryClient, Sentry.ISentryScopeManager { Sentry.SentryId LastEventId { get; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] Sentry.SentryStructuredLogger Logger { get; } void BindException(System.Exception exception, Sentry.ISpan span); Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope); @@ -612,35 +611,24 @@ namespace Sentry [System.Runtime.Serialization.EnumMember(Value="fatal")] Fatal = 4, } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] [System.Diagnostics.DebuggerDisplay("SentryLog \\{ Level = {Level}, Message = \'{Message}\' \\}")] [System.Runtime.CompilerServices.RequiredMember] public sealed class SentryLog { - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] [System.Runtime.CompilerServices.RequiredMember] public Sentry.SentryLogLevel Level { get; init; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] [System.Runtime.CompilerServices.RequiredMember] public string Message { get; init; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public System.Collections.Immutable.ImmutableArray> Parameters { get; init; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public Sentry.SpanId? ParentSpanId { get; init; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public string? Template { get; init; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] [System.Runtime.CompilerServices.RequiredMember] public System.DateTimeOffset Timestamp { get; init; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] [System.Runtime.CompilerServices.RequiredMember] public Sentry.SentryId TraceId { get; init; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void SetAttribute(string key, object value) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public bool TryGetAttribute(string key, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out object? value) { } } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public enum SentryLogLevel { Trace = 1, @@ -720,7 +708,6 @@ namespace Sentry public bool EnableScopeSync { get; set; } public bool EnableSpotlight { get; set; } public string? Environment { get; set; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public Sentry.SentryOptions.SentryExperimentalOptions Experimental { get; set; } public System.Collections.Generic.IList FailedRequestStatusCodes { get; set; } public System.Collections.Generic.IList FailedRequestTargets { get; set; } @@ -807,7 +794,6 @@ namespace Sentry public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } public Sentry.SentryOptions UseStackTraceFactory(Sentry.Extensibility.ISentryStackTraceFactory sentryStackTraceFactory) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public sealed class SentryExperimentalOptions { public bool EnableLogs { get; set; } @@ -904,7 +890,6 @@ namespace Sentry public static Sentry.ITransactionTracer StartTransaction(string name, string operation, Sentry.SentryTraceHeader traceHeader) { } public static Sentry.ITransactionTracer StartTransaction(string name, string operation, string? description) { } public static void UnsetTag(string key) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public static class Experimental { public static Sentry.SentryStructuredLogger Logger { get; } @@ -988,34 +973,21 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SentryStackTrace FromJson(System.Text.Json.JsonElement json) { } } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public abstract class SentryStructuredLogger { protected abstract void CaptureLog(Sentry.SentryLog log); protected abstract void Flush(); - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogDebug(string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogDebug(System.Action configureLog, string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogError(string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogError(System.Action configureLog, string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogFatal(string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogFatal(System.Action configureLog, string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogInfo(string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogInfo(System.Action configureLog, string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogTrace(string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogTrace(System.Action configureLog, string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogWarning(string template, params object[] parameters) { } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public void LogWarning(System.Action configureLog, string template, params object[] parameters) { } } public sealed class SentryThread : Sentry.ISentryJsonSerializable @@ -1410,7 +1382,6 @@ namespace Sentry.Extensibility public static readonly Sentry.Extensibility.DisabledHub Instance; public bool IsEnabled { get; } public Sentry.SentryId LastEventId { get; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public Sentry.SentryStructuredLogger Logger { get; } public void BindClient(Sentry.ISentryClient client) { } public void BindException(System.Exception exception, Sentry.ISpan span) { } @@ -1458,7 +1429,6 @@ namespace Sentry.Extensibility public static readonly Sentry.Extensibility.HubAdapter Instance; public bool IsEnabled { get; } public Sentry.SentryId LastEventId { get; } - [System.Diagnostics.CodeAnalysis.Experimental("SENTRY0001")] public Sentry.SentryStructuredLogger Logger { get; } public void AddBreadcrumb(string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public void AddBreadcrumb(Sentry.Infrastructure.ISystemClock clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } From 56ed2f53191c20512b5ceb5315633470790e1b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Thu, 25 Sep 2025 22:18:53 +0200 Subject: [PATCH 2/6] ref(logs): remove experimental documentation comments --- src/Sentry/SentryOptions.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Sentry/SentryOptions.cs b/src/Sentry/SentryOptions.cs index 913f377968..cfed6098d8 100644 --- a/src/Sentry/SentryOptions.cs +++ b/src/Sentry/SentryOptions.cs @@ -1881,7 +1881,6 @@ internal SentryExperimentalOptions() /// /// When set to , logs are sent to Sentry. /// Defaults to . - /// This API is experimental and it may change in the future. /// /// public bool EnableLogs { get; set; } = false; @@ -1893,7 +1892,6 @@ internal SentryExperimentalOptions() /// /// Sets a callback function to be invoked before sending the log to Sentry. /// When the delegate throws an during invocation, the log will not be captured. - /// This API is experimental and it may change in the future. /// /// /// It can be used to modify the log object before being sent to Sentry. From ed00786aa5e5a88cc10ee9d51d5be7765fdf848d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Thu, 25 Sep 2025 22:46:51 +0200 Subject: [PATCH 3/6] ref(logs): remove Experimental type --- samples/Sentry.Samples.Console.Basic/Program.cs | 8 ++++---- src/Sentry/Extensibility/HubAdapter.cs | 2 +- src/Sentry/SentrySdk.cs | 13 ++----------- .../ApiApprovalTests.Run.DotNet8_0.verified.txt | 5 +---- .../ApiApprovalTests.Run.DotNet9_0.verified.txt | 5 +---- .../ApiApprovalTests.Run.Net4_8.verified.txt | 5 +---- 6 files changed, 10 insertions(+), 28 deletions(-) diff --git a/samples/Sentry.Samples.Console.Basic/Program.cs b/samples/Sentry.Samples.Console.Basic/Program.cs index 6b1815bf93..dfc7723796 100644 --- a/samples/Sentry.Samples.Console.Basic/Program.cs +++ b/samples/Sentry.Samples.Console.Basic/Program.cs @@ -37,7 +37,7 @@ // This option tells Sentry to capture 100% of traces. You still need to start transactions and spans. options.TracesSampleRate = 1.0; - // This option enables Sentry Logs created via SentrySdk.Experimental.Logger. + // This option enables Sentry Logs created via SentrySdk.Logger. options.Experimental.EnableLogs = true; options.Experimental.SetBeforeSendLog(static log => { @@ -73,7 +73,7 @@ async Task FirstFunction() var httpClient = new HttpClient(messageHandler, true); var html = await httpClient.GetStringAsync("https://example.com/"); WriteLine(html); - SentrySdk.Experimental.Logger.LogInfo("HTTP Request completed."); + SentrySdk.Logger.LogInfo("HTTP Request completed."); } async Task SecondFunction() @@ -94,7 +94,7 @@ async Task SecondFunction() SentrySdk.CaptureException(exception); span.Finish(exception); - SentrySdk.Experimental.Logger.LogError(static log => log.SetAttribute("method", nameof(SecondFunction)), + SentrySdk.Logger.LogError(static log => log.SetAttribute("method", nameof(SecondFunction)), "Error with message: {0}", exception.Message); } @@ -109,7 +109,7 @@ async Task ThirdFunction() // Simulate doing some work await Task.Delay(100); - SentrySdk.Experimental.Logger.LogFatal(static log => log.SetAttribute("suppress", true), + SentrySdk.Logger.LogFatal(static log => log.SetAttribute("suppress", true), "Crash imminent!"); // This is an example of an unhandled exception. It will be captured automatically. diff --git a/src/Sentry/Extensibility/HubAdapter.cs b/src/Sentry/Extensibility/HubAdapter.cs index 3f81060c5c..e94a6c1914 100644 --- a/src/Sentry/Extensibility/HubAdapter.cs +++ b/src/Sentry/Extensibility/HubAdapter.cs @@ -35,7 +35,7 @@ private HubAdapter() { } /// /// Forwards the call to . /// - public SentryStructuredLogger Logger { [DebuggerStepThrough] get => SentrySdk.Experimental.Logger; } + public SentryStructuredLogger Logger { [DebuggerStepThrough] get => SentrySdk.Logger; } /// /// Forwards the call to . diff --git a/src/Sentry/SentrySdk.cs b/src/Sentry/SentrySdk.cs index 05c8a394e2..35f014447b 100644 --- a/src/Sentry/SentrySdk.cs +++ b/src/Sentry/SentrySdk.cs @@ -284,17 +284,8 @@ public void Dispose() /// public static bool IsEnabled { [DebuggerStepThrough] get => CurrentHub.IsEnabled; } - /// - /// Experimental Sentry SDK features. - /// - /// - /// This and related experimental APIs may change in the future. - /// - public static class Experimental - { - /// - public static SentryStructuredLogger Logger { [DebuggerStepThrough] get => CurrentHub.Logger; } - } + /// + public static SentryStructuredLogger Logger { [DebuggerStepThrough] get => CurrentHub.Logger; } /// /// Creates a new scope that will terminate when disposed. diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt index fbc1d3b7c4..14734ce218 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt @@ -830,6 +830,7 @@ namespace Sentry { public static bool IsEnabled { get; } public static Sentry.SentryId LastEventId { get; } + public static Sentry.SentryStructuredLogger Logger { get; } public static void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.SentryHint? hint = null) { } public static void AddBreadcrumb(string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void AddBreadcrumb(Sentry.Infrastructure.ISystemClock? clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } @@ -890,10 +891,6 @@ namespace Sentry public static Sentry.ITransactionTracer StartTransaction(string name, string operation, Sentry.SentryTraceHeader traceHeader) { } public static Sentry.ITransactionTracer StartTransaction(string name, string operation, string? description) { } public static void UnsetTag(string key) { } - public static class Experimental - { - public static Sentry.SentryStructuredLogger Logger { get; } - } } public class SentrySession : Sentry.ISentrySession { diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt index fbc1d3b7c4..14734ce218 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt @@ -830,6 +830,7 @@ namespace Sentry { public static bool IsEnabled { get; } public static Sentry.SentryId LastEventId { get; } + public static Sentry.SentryStructuredLogger Logger { get; } public static void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.SentryHint? hint = null) { } public static void AddBreadcrumb(string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void AddBreadcrumb(Sentry.Infrastructure.ISystemClock? clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } @@ -890,10 +891,6 @@ namespace Sentry public static Sentry.ITransactionTracer StartTransaction(string name, string operation, Sentry.SentryTraceHeader traceHeader) { } public static Sentry.ITransactionTracer StartTransaction(string name, string operation, string? description) { } public static void UnsetTag(string key) { } - public static class Experimental - { - public static Sentry.SentryStructuredLogger Logger { get; } - } } public class SentrySession : Sentry.ISentrySession { diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt index cd961b2d1d..6504a008d1 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt @@ -806,6 +806,7 @@ namespace Sentry { public static bool IsEnabled { get; } public static Sentry.SentryId LastEventId { get; } + public static Sentry.SentryStructuredLogger Logger { get; } public static void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.SentryHint? hint = null) { } public static void AddBreadcrumb(string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void AddBreadcrumb(Sentry.Infrastructure.ISystemClock? clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } @@ -866,10 +867,6 @@ namespace Sentry public static Sentry.ITransactionTracer StartTransaction(string name, string operation, Sentry.SentryTraceHeader traceHeader) { } public static Sentry.ITransactionTracer StartTransaction(string name, string operation, string? description) { } public static void UnsetTag(string key) { } - public static class Experimental - { - public static Sentry.SentryStructuredLogger Logger { get; } - } } public class SentrySession : Sentry.ISentrySession { From 227dd3977fa388464450930e26cbac299ec3be12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Thu, 25 Sep 2025 23:17:26 +0200 Subject: [PATCH 4/6] docs: update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cdf7c28d0..a73d39940a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ - In MAUI Android apps, generate and inject UUID to APK and upload ProGuard mapping to Sentry with the UUID ([#4532](https://github.com/getsentry/sentry-dotnet/pull/4532)) - Fixed WASM0001 warning when building Blazor WebAssembly projects ([#4519](https://github.com/getsentry/sentry-dotnet/pull/4519)) +### Experimental + +- Remove `ExperimentalAttribute` from all _Structured Logs_ APIs, and remove `Experimental` property from `SentrySdk`, but keep `Experimental` property on `SentryOptions` ([#4567](https://github.com/getsentry/sentry-dotnet/pull/4567)) + ### Dependencies - Bump Cocoa SDK from v8.56.0 to v8.56.1 ([#4555](https://github.com/getsentry/sentry-dotnet/pull/4555)) From 2ea5abe92f08c615b1bb0342a48aa0109247092c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Tue, 30 Sep 2025 16:18:33 +0200 Subject: [PATCH 5/6] docs: change CHANGELOG section header --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a73d39940a..abd5e74690 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ - In MAUI Android apps, generate and inject UUID to APK and upload ProGuard mapping to Sentry with the UUID ([#4532](https://github.com/getsentry/sentry-dotnet/pull/4532)) - Fixed WASM0001 warning when building Blazor WebAssembly projects ([#4519](https://github.com/getsentry/sentry-dotnet/pull/4519)) -### Experimental +### API Changes - Remove `ExperimentalAttribute` from all _Structured Logs_ APIs, and remove `Experimental` property from `SentrySdk`, but keep `Experimental` property on `SentryOptions` ([#4567](https://github.com/getsentry/sentry-dotnet/pull/4567)) From cc6733ee0afebb27095834bc7904b04da8bc9509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Tue, 30 Sep 2025 16:19:37 +0200 Subject: [PATCH 6/6] docs: improve XML docs --- src/Sentry/SentryLog.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Sentry/SentryLog.cs b/src/Sentry/SentryLog.cs index ee588d7d75..3fec301b4e 100644 --- a/src/Sentry/SentryLog.cs +++ b/src/Sentry/SentryLog.cs @@ -4,8 +4,13 @@ namespace Sentry; /// -/// Represents the Sentry Log protocol. +/// Represents a Sentry Structured Log. /// +/// +/// Sentry Docs: . +/// Sentry Developer Documentation: . +/// Sentry .NET SDK Docs: . +/// [DebuggerDisplay(@"SentryLog \{ Level = {Level}, Message = '{Message}' \}")] public sealed class SentryLog {