Skip to content

Commit 0c6ca6a

Browse files
authored
ref(logs): remove ExperimentalAttribute and Experimental type from SentrySdk (#4567)
1 parent de8dc9a commit 0c6ca6a

14 files changed

+20
-152
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
- 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))
1515
- Fixed WASM0001 warning when building Blazor WebAssembly projects ([#4519](https://github.com/getsentry/sentry-dotnet/pull/4519))
1616

17+
### API Changes
18+
19+
- 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))
20+
1721
### Dependencies
1822

1923
- Bump Cocoa SDK from v8.56.0 to v8.56.2 ([#4555](https://github.com/getsentry/sentry-dotnet/pull/4555), [#4572](https://github.com/getsentry/sentry-dotnet/pull/4572))

samples/Sentry.Samples.Console.Basic/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
// This option tells Sentry to capture 100% of traces. You still need to start transactions and spans.
3838
options.TracesSampleRate = 1.0;
3939

40-
// This option enables Sentry Logs created via SentrySdk.Experimental.Logger.
40+
// This option enables Sentry Logs created via SentrySdk.Logger.
4141
options.Experimental.EnableLogs = true;
4242
options.Experimental.SetBeforeSendLog(static log =>
4343
{
@@ -73,7 +73,7 @@ async Task FirstFunction()
7373
var httpClient = new HttpClient(messageHandler, true);
7474
var html = await httpClient.GetStringAsync("https://example.com/");
7575
WriteLine(html);
76-
SentrySdk.Experimental.Logger.LogInfo("HTTP Request completed.");
76+
SentrySdk.Logger.LogInfo("HTTP Request completed.");
7777
}
7878

7979
async Task SecondFunction()
@@ -94,7 +94,7 @@ async Task SecondFunction()
9494
SentrySdk.CaptureException(exception);
9595
span.Finish(exception);
9696

97-
SentrySdk.Experimental.Logger.LogError(static log => log.SetAttribute("method", nameof(SecondFunction)),
97+
SentrySdk.Logger.LogError(static log => log.SetAttribute("method", nameof(SecondFunction)),
9898
"Error with message: {0}", exception.Message);
9999
}
100100

@@ -109,7 +109,7 @@ async Task ThirdFunction()
109109
// Simulate doing some work
110110
await Task.Delay(100);
111111

112-
SentrySdk.Experimental.Logger.LogFatal(static log => log.SetAttribute("suppress", true),
112+
SentrySdk.Logger.LogFatal(static log => log.SetAttribute("suppress", true),
113113
"Crash imminent!");
114114

115115
// This is an example of an unhandled exception. It will be captured automatically.

src/Sentry/Extensibility/DisabledHub.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,6 @@ public void CaptureUserFeedback(UserFeedback userFeedback)
257257

258258
/// <summary>
259259
/// Disabled Logger.
260-
/// <para>This API is experimental and it may change in the future.</para>
261260
/// </summary>
262-
[Experimental(Infrastructure.DiagnosticId.ExperimentalFeature)]
263261
public SentryStructuredLogger Logger => DisabledSentryStructuredLogger.Instance;
264262
}

src/Sentry/Extensibility/HubAdapter.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ private HubAdapter() { }
3434

3535
/// <summary>
3636
/// Forwards the call to <see cref="SentrySdk"/>.
37-
/// <para>This API is experimental and it may change in the future.</para>
3837
/// </summary>
39-
[Experimental(DiagnosticId.ExperimentalFeature)]
40-
public SentryStructuredLogger Logger { [DebuggerStepThrough] get => SentrySdk.Experimental.Logger; }
38+
public SentryStructuredLogger Logger { [DebuggerStepThrough] get => SentrySdk.Logger; }
4139

4240
/// <summary>
4341
/// Forwards the call to <see cref="SentrySdk"/>.

src/Sentry/IHub.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public interface IHub : ISentryClient, ISentryScopeManager
1919

2020
/// <summary>
2121
/// Creates and sends logs to Sentry.
22-
/// <para>This API is experimental and it may change in the future.</para>
2322
/// </summary>
2423
/// <remarks>
2524
/// Available options:
@@ -28,7 +27,6 @@ public interface IHub : ISentryClient, ISentryScopeManager
2827
/// <item><see cref="Sentry.SentryOptions.SentryExperimentalOptions.SetBeforeSendLog(System.Func{SentryLog, SentryLog})"/></item>
2928
/// </list>
3029
/// </remarks>
31-
[Experimental(Infrastructure.DiagnosticId.ExperimentalFeature)]
3230
public SentryStructuredLogger Logger { get; }
3331

3432
/// <summary>

src/Sentry/SentryLog.cs

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
using Sentry.Extensibility;
2-
using Sentry.Infrastructure;
32
using Sentry.Protocol;
43

54
namespace Sentry;
65

76
/// <summary>
8-
/// Represents the Sentry Log protocol.
9-
/// <para>This API is experimental and it may change in the future.</para>
7+
/// Represents a Sentry Structured Log.
108
/// </summary>
11-
[Experimental(DiagnosticId.ExperimentalFeature)]
9+
/// <remarks>
10+
/// Sentry Docs: <see href="https://docs.sentry.io/product/explore/logs/"/>.
11+
/// Sentry Developer Documentation: <see href="https://develop.sentry.dev/sdk/telemetry/logs/"/>.
12+
/// Sentry .NET SDK Docs: <see href="https://docs.sentry.io/platforms/dotnet/logs/"/>.
13+
/// </remarks>
1214
[DebuggerDisplay(@"SentryLog \{ Level = {Level}, Message = '{Message}' \}")]
1315
public sealed class SentryLog
1416
{
@@ -27,59 +29,44 @@ internal SentryLog(DateTimeOffset timestamp, SentryId traceId, SentryLogLevel le
2729

2830
/// <summary>
2931
/// The timestamp of the log.
30-
/// <para>This API is experimental and it may change in the future.</para>
3132
/// </summary>
3233
/// <remarks>
3334
/// Sent as seconds since the Unix epoch.
3435
/// </remarks>
35-
[Experimental(DiagnosticId.ExperimentalFeature)]
3636
public required DateTimeOffset Timestamp { get; init; }
3737

3838
/// <summary>
3939
/// The trace id of the log.
40-
/// <para>This API is experimental and it may change in the future.</para>
4140
/// </summary>
42-
[Experimental(DiagnosticId.ExperimentalFeature)]
4341
public required SentryId TraceId { get; init; }
4442

4543
/// <summary>
4644
/// The severity level of the log.
47-
/// <para>This API is experimental and it may change in the future.</para>
4845
/// </summary>
49-
[Experimental(DiagnosticId.ExperimentalFeature)]
5046
public required SentryLogLevel Level { get; init; }
5147

5248
/// <summary>
5349
/// The formatted log message.
54-
/// <para>This API is experimental and it may change in the future.</para>
5550
/// </summary>
56-
[Experimental(DiagnosticId.ExperimentalFeature)]
5751
public required string Message { get; init; }
5852

5953
/// <summary>
6054
/// The parameterized template string.
61-
/// <para>This API is experimental and it may change in the future.</para>
6255
/// </summary>
63-
[Experimental(DiagnosticId.ExperimentalFeature)]
6456
public string? Template { get; init; }
6557

6658
/// <summary>
6759
/// The parameters to the template string.
68-
/// <para>This API is experimental and it may change in the future.</para>
6960
/// </summary>
70-
[Experimental(DiagnosticId.ExperimentalFeature)]
7161
public ImmutableArray<KeyValuePair<string, object>> Parameters { get; init; }
7262

7363
/// <summary>
7464
/// The span id of the span that was active when the log was collected.
75-
/// <para>This API is experimental and it may change in the future.</para>
7665
/// </summary>
77-
[Experimental(DiagnosticId.ExperimentalFeature)]
7866
public SpanId? ParentSpanId { get; init; }
7967

8068
/// <summary>
8169
/// Gets the attribute value associated with the specified key.
82-
/// <para>This API is experimental and it may change in the future.</para>
8370
/// </summary>
8471
/// <remarks>
8572
/// Returns <see langword="true"/> if the <see cref="SentryLog"/> contains an attribute with the specified key and it's value is not <see langword="null"/>.
@@ -128,7 +115,6 @@ internal SentryLog(DateTimeOffset timestamp, SentryId traceId, SentryLogLevel le
128115
/// </list>
129116
/// </remarks>
130117
/// <seealso href="https://develop.sentry.dev/sdk/telemetry/logs/"/>
131-
[Experimental(DiagnosticId.ExperimentalFeature)]
132118
public bool TryGetAttribute(string key, [NotNullWhen(true)] out object? value)
133119
{
134120
if (_attributes.TryGetValue(key, out var attribute) && attribute.Value is not null)
@@ -155,9 +141,7 @@ internal bool TryGetAttribute(string key, [NotNullWhen(true)] out string? value)
155141

156142
/// <summary>
157143
/// Set a key-value pair of data attached to the log.
158-
/// <para>This API is experimental and it may change in the future.</para>
159144
/// </summary>
160-
[Experimental(DiagnosticId.ExperimentalFeature)]
161145
public void SetAttribute(string key, object value)
162146
{
163147
_attributes[key] = new SentryAttribute(value);

src/Sentry/SentryLogLevel.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
using Sentry.Extensibility;
2-
using Sentry.Infrastructure;
32

43
namespace Sentry;
54

65
/// <summary>
76
/// The severity of the structured log.
8-
/// <para>This API is experimental and it may change in the future.</para>
97
/// </summary>
108
/// <remarks>
119
/// The named constants use the value of the lowest severity number per severity level:
@@ -41,7 +39,6 @@ namespace Sentry;
4139
/// </list>
4240
/// </remarks>
4341
/// <seealso href="https://develop.sentry.dev/sdk/telemetry/logs/"/>
44-
[Experimental(DiagnosticId.ExperimentalFeature)]
4542
public enum SentryLogLevel
4643
{
4744
/// <summary>

src/Sentry/SentryOptions.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,7 +1870,6 @@ internal static List<StringOrRegex> GetDefaultInAppExclude() =>
18701870
/// <remarks>
18711871
/// This and related experimental APIs may change in the future.
18721872
/// </remarks>
1873-
[Experimental(DiagnosticId.ExperimentalFeature)]
18741873
public SentryExperimentalOptions Experimental { get; set; } = new();
18751874

18761875
/// <summary>
@@ -1879,7 +1878,6 @@ internal static List<StringOrRegex> GetDefaultInAppExclude() =>
18791878
/// <remarks>
18801879
/// This and related experimental APIs may change in the future.
18811880
/// </remarks>
1882-
[Experimental(DiagnosticId.ExperimentalFeature)]
18831881
public sealed class SentryExperimentalOptions
18841882
{
18851883
internal SentryExperimentalOptions()
@@ -1889,7 +1887,6 @@ internal SentryExperimentalOptions()
18891887
/// <summary>
18901888
/// When set to <see langword="true"/>, logs are sent to Sentry.
18911889
/// Defaults to <see langword="false"/>.
1892-
/// <para>This API is experimental and it may change in the future.</para>
18931890
/// </summary>
18941891
/// <seealso href="https://develop.sentry.dev/sdk/telemetry/logs/"/>
18951892
public bool EnableLogs { get; set; } = false;
@@ -1901,7 +1898,6 @@ internal SentryExperimentalOptions()
19011898
/// <summary>
19021899
/// Sets a callback function to be invoked before sending the log to Sentry.
19031900
/// When the delegate throws an <see cref="Exception"/> during invocation, the log will not be captured.
1904-
/// <para>This API is experimental and it may change in the future.</para>
19051901
/// </summary>
19061902
/// <remarks>
19071903
/// It can be used to modify the log object before being sent to Sentry.

src/Sentry/SentrySdk.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -284,18 +284,8 @@ public void Dispose()
284284
/// </summary>
285285
public static bool IsEnabled { [DebuggerStepThrough] get => CurrentHub.IsEnabled; }
286286

287-
/// <summary>
288-
/// Experimental Sentry SDK features.
289-
/// </summary>
290-
/// <remarks>
291-
/// This and related experimental APIs may change in the future.
292-
/// </remarks>
293-
[Experimental(DiagnosticId.ExperimentalFeature)]
294-
public static class Experimental
295-
{
296-
/// <inheritdoc cref="IHub.Logger" />
297-
public static SentryStructuredLogger Logger { [DebuggerStepThrough] get => CurrentHub.Logger; }
298-
}
287+
/// <inheritdoc cref="IHub.Logger" />
288+
public static SentryStructuredLogger Logger { [DebuggerStepThrough] get => CurrentHub.Logger; }
299289

300290
/// <summary>
301291
/// Creates a new scope that will terminate when disposed.

0 commit comments

Comments
 (0)