From 3a51b492ffc4e7bd921ab8e30ad6f4fcc267ddb0 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 18 Mar 2026 17:28:46 +0100 Subject: [PATCH 1/6] no experimental no more --- .../ScriptableSentryUnityOptions.cs | 2 +- src/Sentry.Unity/SentrySdk.Dotnet.cs | 47 +++++-------------- 2 files changed, 13 insertions(+), 36 deletions(-) diff --git a/src/Sentry.Unity/ScriptableSentryUnityOptions.cs b/src/Sentry.Unity/ScriptableSentryUnityOptions.cs index 55f4ad6a1..87e93fbb4 100644 --- a/src/Sentry.Unity/ScriptableSentryUnityOptions.cs +++ b/src/Sentry.Unity/ScriptableSentryUnityOptions.cs @@ -228,7 +228,7 @@ internal SentryUnityOptions ToSentryUnityOptions( AddBreadcrumbsWithStructuredLogs = AddBreadcrumbsWithStructuredLogs }; - options.Experimental.EnableMetrics = EnableMetrics; + options.EnableMetrics = EnableMetrics; // By default, the cacheDirectoryPath gets set on known platforms. We're overwriting this behaviour here. if (!EnableOfflineCaching) diff --git a/src/Sentry.Unity/SentrySdk.Dotnet.cs b/src/Sentry.Unity/SentrySdk.Dotnet.cs index 2539aa3b2..3b2c55ace 100644 --- a/src/Sentry.Unity/SentrySdk.Dotnet.cs +++ b/src/Sentry.Unity/SentrySdk.Dotnet.cs @@ -54,14 +54,21 @@ public static partial class SentrySdk /// /// Gets the structured logger instance for creating and sending logs to Sentry. /// - /// - /// Use this property to access structured logging functionality. Logs are only sent when - /// 's - /// is set to true. - /// /// public static SentryStructuredLogger Logger { [DebuggerStepThrough] get => Sentry.SentrySdk.Logger; } + /// + /// Generates and sends metrics to Sentry. + /// + /// + /// Available options: + /// + /// + /// + /// + /// + public static SentryMetricEmitter Metrics { [DebuggerStepThrough] get => Sentry.SentrySdk.Metrics; } + /// /// Creates a new scope that will terminate when disposed. /// @@ -546,34 +553,4 @@ public static void ResumeSession() /// [Obsolete("WARNING: This method deliberately causes a crash, and should not be used in a real application.")] public static void CauseCrash(CrashType crashType) => Sentry.SentrySdk.CauseCrash(crashType); - - /// - /// Sentry features that are currently in an experimental state. - /// - /// - /// Experimental features are subject to binary, source and behavioral breaking changes in future updates. - /// - public static ExperimentalSentrySdk Experimental { get; } = new(); - - /// - /// Sentry features that are currently in an experimental state. - /// - /// - /// Experimental features are subject to binary, source and behavioral breaking changes in future updates. - /// - public sealed class ExperimentalSentrySdk - { - internal ExperimentalSentrySdk() - { - } - - /// - /// Gets the metric emitter for emitting counters, gauges, and distributions connected to traces. - /// - public SentryMetricEmitter Metrics - { - [DebuggerStepThrough] - get => Sentry.SentrySdk.Experimental.Metrics; - } - } } From c2c67fd44341ccafa9ca33d00d01e1456874103f Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 18 Mar 2026 17:36:21 +0100 Subject: [PATCH 2/6] Updated CHANGELOG.md --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c5497c29..57d81d31b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,16 @@ ## Unreleased +### Features + +- Metrics are no longer experimental ([#2592](https://github.com/getsentry/sentry-unity/pull/2592)) + +## 4.1.2 + ### Fixes - `CaptureFeedback` now returns a `SentryId` and exposes a `CaptureFeedbackResult` out parameter to indicate whether feedback was captured successfully ([#2589](https://github.com/getsentry/sentry-unity/pull/2579)) -- When exporting a NSP ROM File for Switch the SKD now correctly uploads the debug symbols ([#2580](https://github.com/getsentry/sentry-unity/pull/2580)) +- When exporting a NSP ROM File for Switch the SKD now correctly uploads the debug symbols ([#2580](https://github.com/getsentry/sentry-unity/pull/2580)) - The SDK now also uses `.sentry-native` as a subdirectory for native support on desktop platforms. It now also falls back to `Application.persistentDataPath` instead of the current working directory. Note: `crashedLastRun` may report `false` for the first time after upgrading. ([#2547](https://github.com/getsentry/sentry-unity/pull/2547)) - The currently experimental Metrics are now opt-in by default ([#2546](https://github.com/getsentry/sentry-unity/pull/2546)) - When targeting Android, the SDK now syncs `AppStartTime` and `AppBuildType` to the native layer ([#2557](https://github.com/getsentry/sentry-unity/pull/2557)) From a550752b0abeddd67687d0a074eb5f79abfae02f Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 18 Mar 2026 17:39:53 +0100 Subject: [PATCH 3/6] sync attachment files --- .../AndroidJavaScopeObserver.cs | 6 +++++ src/Sentry.Unity.Android/SentryJava.cs | 26 +++++++++++++++++++ src/Sentry.Unity.Native/CFunctions.cs | 6 +++++ .../NativeScopeObserver.cs | 6 +++++ src/Sentry.Unity.iOS/NativeScopeObserver.cs | 10 +++++++ src/Sentry.Unity/ScopeObserver.cs | 23 ++++++++++++++++ src/sentry-dotnet | 2 +- .../TestSentryJava.cs | 4 +++ 8 files changed, 82 insertions(+), 1 deletion(-) diff --git a/src/Sentry.Unity.Android/AndroidJavaScopeObserver.cs b/src/Sentry.Unity.Android/AndroidJavaScopeObserver.cs index 55e51705f..b620cd577 100644 --- a/src/Sentry.Unity.Android/AndroidJavaScopeObserver.cs +++ b/src/Sentry.Unity.Android/AndroidJavaScopeObserver.cs @@ -36,4 +36,10 @@ public override void UnsetUserImpl() => public override void SetTraceImpl(SentryId traceId, SpanId spanId) => _sentryJava.SetTrace(traceId, spanId); + + public override void AddFileAttachmentImpl(string filePath, string fileName, string? contentType) => + _sentryJava.AddAttachment(filePath, fileName, contentType); + + public override void ClearAttachmentsImpl() => + _sentryJava.ClearAttachments(); } diff --git a/src/Sentry.Unity.Android/SentryJava.cs b/src/Sentry.Unity.Android/SentryJava.cs index 9a68442aa..0791f0142 100644 --- a/src/Sentry.Unity.Android/SentryJava.cs +++ b/src/Sentry.Unity.Android/SentryJava.cs @@ -42,6 +42,8 @@ public void WriteScope( public void SetUser(SentryUser user); public void UnsetUser(); public void SetTrace(SentryId traceId, SpanId spanId); + void AddAttachment(string path, string fileName, string? contentType); + void ClearAttachments(); } /// @@ -361,6 +363,30 @@ public void SetTrace(SentryId traceId, SpanId spanId) }); } + public void AddAttachment(string path, string fileName, string? contentType) + { + RunJniSafe(() => + { + using var attachment = contentType is not null + ? new AndroidJavaObject("io.sentry.Attachment", path, fileName, contentType) + : new AndroidJavaObject("io.sentry.Attachment", path, fileName); + + using var sentry = GetSentryJava(); + sentry.CallStatic("configureScope", new ScopeCallback(scope => + scope.Call("addAttachment", attachment))); + }); + } + + public void ClearAttachments() + { + RunJniSafe(() => + { + using var sentry = GetSentryJava(); + sentry.CallStatic("configureScope", new ScopeCallback(scope => + scope.Call("clearAttachments"))); + }); + } + // https://github.com/getsentry/sentry-java/blob/db4dfc92f202b1cefc48d019fdabe24d487db923/sentry/src/main/java/io/sentry/SentryLevel.java#L4-L9 internal static string GetLevelString(SentryLevel level) => level switch { diff --git a/src/Sentry.Unity.Native/CFunctions.cs b/src/Sentry.Unity.Native/CFunctions.cs index 4a644e70c..70b608dbf 100644 --- a/src/Sentry.Unity.Native/CFunctions.cs +++ b/src/Sentry.Unity.Native/CFunctions.cs @@ -165,6 +165,12 @@ internal static void SetValueIfNotNull(sentry_value_t obj, string key, long? val [DllImport(SentryLib)] internal static extern void sentry_set_trace(string traceId, string parentSpanId); + [DllImport(SentryLib)] + internal static extern IntPtr sentry_attach_file(string path); + + [DllImport(SentryLib)] + internal static extern void sentry_clear_attachments(); + internal static readonly Lazy> DebugImages = new(LoadDebugImages); private static IEnumerable LoadDebugImages() diff --git a/src/Sentry.Unity.Native/NativeScopeObserver.cs b/src/Sentry.Unity.Native/NativeScopeObserver.cs index bebeae55c..ef00f360f 100644 --- a/src/Sentry.Unity.Native/NativeScopeObserver.cs +++ b/src/Sentry.Unity.Native/NativeScopeObserver.cs @@ -43,6 +43,12 @@ public override void SetUserImpl(SentryUser user) public override void SetTraceImpl(SentryId traceId, SpanId spanId) => C.sentry_set_trace(traceId.ToString(), spanId.ToString()); + public override void AddFileAttachmentImpl(string filePath, string fileName, string? contentType) => + C.sentry_attach_file(filePath); + + public override void ClearAttachmentsImpl() => + C.sentry_clear_attachments(); + private static string GetTimestamp(DateTimeOffset timestamp) => // "o": Using ISO 8601 to make sure the timestamp makes it to the bridge correctly. // https://docs.microsoft.com/en-gb/dotnet/standard/base-types/standard-date-and-time-format-strings#Roundtrip diff --git a/src/Sentry.Unity.iOS/NativeScopeObserver.cs b/src/Sentry.Unity.iOS/NativeScopeObserver.cs index 8c8637eb4..3bbfba38d 100644 --- a/src/Sentry.Unity.iOS/NativeScopeObserver.cs +++ b/src/Sentry.Unity.iOS/NativeScopeObserver.cs @@ -29,6 +29,16 @@ public override void SetUserImpl(SentryUser user) => public override void SetTraceImpl(SentryId traceId, SpanId spanId) => SentryCocoaBridgeProxy.SetTrace(traceId.ToString(), spanId.ToString()); + public override void AddFileAttachmentImpl(string filePath, string fileName, string? contentType) + { + // iOS/macOS attachment sync to sentry-cocoa is not yet supported. + } + + public override void ClearAttachmentsImpl() + { + // iOS/macOS attachment sync to sentry-cocoa is not yet supported. + } + internal static string GetTimestamp(DateTimeOffset timestamp) => // "o": Using ISO 8601 to make sure the timestamp makes it to the bridge correctly. // https://docs.microsoft.com/en-gb/dotnet/standard/base-types/standard-date-and-time-format-strings#Roundtrip diff --git a/src/Sentry.Unity/ScopeObserver.cs b/src/Sentry.Unity/ScopeObserver.cs index 556a83da4..e0af33707 100644 --- a/src/Sentry.Unity/ScopeObserver.cs +++ b/src/Sentry.Unity/ScopeObserver.cs @@ -86,4 +86,27 @@ public void SetTrace(SentryId traceId, SpanId spanId) } public abstract void SetTraceImpl(SentryId traceId, SpanId spanId); + + public void AddAttachment(SentryAttachment attachment) + { + if (attachment.Content is FileAttachmentContent fileContent) + { + _options.LogDebug("{0} Scope Sync - Adding file attachment \"{1}\"", _name, fileContent.FilePath); + AddFileAttachmentImpl(fileContent.FilePath, attachment.FileName, attachment.ContentType); + } + else + { + _options.LogDebug("{0} Scope Sync - Skipping non-file attachment \"{1}\" (only file-path attachments sync to native)", _name, attachment.FileName); + } + } + + public abstract void AddFileAttachmentImpl(string filePath, string fileName, string? contentType); + + public void ClearAttachments() + { + _options.LogDebug("{0} Scope Sync - Clearing attachments", _name); + ClearAttachmentsImpl(); + } + + public abstract void ClearAttachmentsImpl(); } diff --git a/src/sentry-dotnet b/src/sentry-dotnet index 248f45541..9cd522453 160000 --- a/src/sentry-dotnet +++ b/src/sentry-dotnet @@ -1 +1 @@ -Subproject commit 248f45541c5e23e7fe425cdeb98c187389de0aa8 +Subproject commit 9cd522453f94abd12d713d7f968c5aa21f8449c1 diff --git a/test/Sentry.Unity.Android.Tests/TestSentryJava.cs b/test/Sentry.Unity.Android.Tests/TestSentryJava.cs index 08dbe299c..5cc08fbe7 100644 --- a/test/Sentry.Unity.Android.Tests/TestSentryJava.cs +++ b/test/Sentry.Unity.Android.Tests/TestSentryJava.cs @@ -54,4 +54,8 @@ public void SetUser(SentryUser user) { } public void UnsetUser() { } public void SetTrace(SentryId traceId, SpanId spanId) { } + + public void AddAttachment(string path, string fileName, string? contentType) { } + + public void ClearAttachments() { } } From 79b8aff7bc8a8aadadec242b059ff6dafad906b7 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 19 Mar 2026 11:54:38 +0100 Subject: [PATCH 4/6] bytes --- Directory.Build.targets | 23 ++++++++++++++----- modules/sentry-java | 2 +- modules/sentry-native | 2 +- .../AndroidJavaScopeObserver.cs | 3 +++ src/Sentry.Unity.Android/SentryJava.cs | 15 ++++++++++++ src/Sentry.Unity.Native/CFunctions.cs | 3 +++ .../NativeScopeObserver.cs | 3 +++ src/Sentry.Unity.iOS/NativeScopeObserver.cs | 5 ++++ src/Sentry.Unity/ScopeObserver.cs | 9 +++++++- src/sentry-dotnet | 2 +- .../TestSentryJava.cs | 2 ++ 11 files changed, 59 insertions(+), 10 deletions(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index 9375f617a..634a3a3e1 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -221,6 +221,12 @@ Expected to exist: + + + + + + @@ -246,28 +252,33 @@ Expected to exist: $([System.IO.File]::ReadAllText("$(RepoRoot)modules/sentry-java/gradle/libs.versions.toml")) $([System.Text.RegularExpressions.Regex]::Match($(PropertiesContent), 'sentry-native-ndk\s*=\s*\{[^}]*version\s*=\s*"([^"]+)"').Groups[1].Value) + $(RepoRoot)modules/sentry-native/ndk/lib/build/outputs/aar/sentry-native-ndk-release.aar + + + + - + - + - + diff --git a/modules/sentry-java b/modules/sentry-java index c40144aa5..6278324e0 160000 --- a/modules/sentry-java +++ b/modules/sentry-java @@ -1 +1 @@ -Subproject commit c40144aa5a4f99cf0d72048eb7e870dee8c7f0a4 +Subproject commit 6278324e01bd9ae25c3b8c9c8e95b49a3e27151d diff --git a/modules/sentry-native b/modules/sentry-native index 45e4a1d3f..e64536924 160000 --- a/modules/sentry-native +++ b/modules/sentry-native @@ -1 +1 @@ -Subproject commit 45e4a1d3f8078043eb23e3d695689a1a1fa24020 +Subproject commit e645369242e6445c2732452677e0388de3692132 diff --git a/src/Sentry.Unity.Android/AndroidJavaScopeObserver.cs b/src/Sentry.Unity.Android/AndroidJavaScopeObserver.cs index b620cd577..65936ac79 100644 --- a/src/Sentry.Unity.Android/AndroidJavaScopeObserver.cs +++ b/src/Sentry.Unity.Android/AndroidJavaScopeObserver.cs @@ -40,6 +40,9 @@ public override void SetTraceImpl(SentryId traceId, SpanId spanId) => public override void AddFileAttachmentImpl(string filePath, string fileName, string? contentType) => _sentryJava.AddAttachment(filePath, fileName, contentType); + public override void AddByteAttachmentImpl(byte[] data, string fileName, string? contentType) => + _sentryJava.AddAttachmentBytes(data, fileName, contentType); + public override void ClearAttachmentsImpl() => _sentryJava.ClearAttachments(); } diff --git a/src/Sentry.Unity.Android/SentryJava.cs b/src/Sentry.Unity.Android/SentryJava.cs index 0791f0142..918acc746 100644 --- a/src/Sentry.Unity.Android/SentryJava.cs +++ b/src/Sentry.Unity.Android/SentryJava.cs @@ -43,6 +43,7 @@ public void WriteScope( public void UnsetUser(); public void SetTrace(SentryId traceId, SpanId spanId); void AddAttachment(string path, string fileName, string? contentType); + void AddAttachmentBytes(byte[] data, string fileName, string? contentType); void ClearAttachments(); } @@ -377,6 +378,20 @@ public void AddAttachment(string path, string fileName, string? contentType) }); } + public void AddAttachmentBytes(byte[] data, string fileName, string? contentType) + { + RunJniSafe(() => + { + using var attachment = contentType is not null + ? new AndroidJavaObject("io.sentry.Attachment", data, fileName, contentType) + : new AndroidJavaObject("io.sentry.Attachment", data, fileName); + + using var sentry = GetSentryJava(); + sentry.CallStatic("configureScope", new ScopeCallback(scope => + scope.Call("addAttachment", attachment))); + }); + } + public void ClearAttachments() { RunJniSafe(() => diff --git a/src/Sentry.Unity.Native/CFunctions.cs b/src/Sentry.Unity.Native/CFunctions.cs index 70b608dbf..212fc0ed7 100644 --- a/src/Sentry.Unity.Native/CFunctions.cs +++ b/src/Sentry.Unity.Native/CFunctions.cs @@ -168,6 +168,9 @@ internal static void SetValueIfNotNull(sentry_value_t obj, string key, long? val [DllImport(SentryLib)] internal static extern IntPtr sentry_attach_file(string path); + [DllImport(SentryLib)] + internal static extern IntPtr sentry_attach_bytes(byte[] buf, UIntPtr buf_len, string filename); + [DllImport(SentryLib)] internal static extern void sentry_clear_attachments(); diff --git a/src/Sentry.Unity.Native/NativeScopeObserver.cs b/src/Sentry.Unity.Native/NativeScopeObserver.cs index ef00f360f..c99e11641 100644 --- a/src/Sentry.Unity.Native/NativeScopeObserver.cs +++ b/src/Sentry.Unity.Native/NativeScopeObserver.cs @@ -46,6 +46,9 @@ public override void SetTraceImpl(SentryId traceId, SpanId spanId) => public override void AddFileAttachmentImpl(string filePath, string fileName, string? contentType) => C.sentry_attach_file(filePath); + public override void AddByteAttachmentImpl(byte[] data, string fileName, string? contentType) => + C.sentry_attach_bytes(data, (UIntPtr)data.Length, fileName); + public override void ClearAttachmentsImpl() => C.sentry_clear_attachments(); diff --git a/src/Sentry.Unity.iOS/NativeScopeObserver.cs b/src/Sentry.Unity.iOS/NativeScopeObserver.cs index 3bbfba38d..0358d6086 100644 --- a/src/Sentry.Unity.iOS/NativeScopeObserver.cs +++ b/src/Sentry.Unity.iOS/NativeScopeObserver.cs @@ -34,6 +34,11 @@ public override void AddFileAttachmentImpl(string filePath, string fileName, str // iOS/macOS attachment sync to sentry-cocoa is not yet supported. } + public override void AddByteAttachmentImpl(byte[] data, string fileName, string? contentType) + { + // iOS/macOS attachment sync to sentry-cocoa is not yet supported. + } + public override void ClearAttachmentsImpl() { // iOS/macOS attachment sync to sentry-cocoa is not yet supported. diff --git a/src/Sentry.Unity/ScopeObserver.cs b/src/Sentry.Unity/ScopeObserver.cs index e0af33707..3ae361163 100644 --- a/src/Sentry.Unity/ScopeObserver.cs +++ b/src/Sentry.Unity/ScopeObserver.cs @@ -94,14 +94,21 @@ public void AddAttachment(SentryAttachment attachment) _options.LogDebug("{0} Scope Sync - Adding file attachment \"{1}\"", _name, fileContent.FilePath); AddFileAttachmentImpl(fileContent.FilePath, attachment.FileName, attachment.ContentType); } + else if (attachment.Content is ByteAttachmentContent byteContent) + { + _options.LogDebug("{0} Scope Sync - Adding byte attachment \"{1}\" ({2} bytes)", _name, attachment.FileName, byteContent.Bytes.Length); + AddByteAttachmentImpl(byteContent.Bytes, attachment.FileName, attachment.ContentType); + } else { - _options.LogDebug("{0} Scope Sync - Skipping non-file attachment \"{1}\" (only file-path attachments sync to native)", _name, attachment.FileName); + _options.LogDebug("{0} Scope Sync - Skipping attachment \"{1}\" (unsupported content type for native sync)", _name, attachment.FileName); } } public abstract void AddFileAttachmentImpl(string filePath, string fileName, string? contentType); + public abstract void AddByteAttachmentImpl(byte[] data, string fileName, string? contentType); + public void ClearAttachments() { _options.LogDebug("{0} Scope Sync - Clearing attachments", _name); diff --git a/src/sentry-dotnet b/src/sentry-dotnet index 9cd522453..c6cc05545 160000 --- a/src/sentry-dotnet +++ b/src/sentry-dotnet @@ -1 +1 @@ -Subproject commit 9cd522453f94abd12d713d7f968c5aa21f8449c1 +Subproject commit c6cc055451289a6361fa60ae7368a10b494475dc diff --git a/test/Sentry.Unity.Android.Tests/TestSentryJava.cs b/test/Sentry.Unity.Android.Tests/TestSentryJava.cs index 5cc08fbe7..195d94221 100644 --- a/test/Sentry.Unity.Android.Tests/TestSentryJava.cs +++ b/test/Sentry.Unity.Android.Tests/TestSentryJava.cs @@ -57,5 +57,7 @@ public void SetTrace(SentryId traceId, SpanId spanId) { } public void AddAttachment(string path, string fileName, string? contentType) { } + public void AddAttachmentBytes(byte[] data, string fileName, string? contentType) { } + public void ClearAttachments() { } } From ec97f56afe569b265b6a43c3207e782eea69ce16 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 19 Mar 2026 13:24:32 +0100 Subject: [PATCH 5/6] . --- src/sentry-dotnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sentry-dotnet b/src/sentry-dotnet index c6cc05545..2f133179a 160000 --- a/src/sentry-dotnet +++ b/src/sentry-dotnet @@ -1 +1 @@ -Subproject commit c6cc055451289a6361fa60ae7368a10b494475dc +Subproject commit 2f133179a6f7e3a1f946ac7dc93dd497b0514517 From fca1147ef6a4654fc4c4441027f7ec13266e9b45 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 19 Mar 2026 13:25:10 +0100 Subject: [PATCH 6/6] Revert "no experimental no more" This reverts commit 3a51b492ffc4e7bd921ab8e30ad6f4fcc267ddb0. --- .../ScriptableSentryUnityOptions.cs | 2 +- src/Sentry.Unity/SentrySdk.Dotnet.cs | 47 ++++++++++++++----- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/src/Sentry.Unity/ScriptableSentryUnityOptions.cs b/src/Sentry.Unity/ScriptableSentryUnityOptions.cs index 87e93fbb4..55f4ad6a1 100644 --- a/src/Sentry.Unity/ScriptableSentryUnityOptions.cs +++ b/src/Sentry.Unity/ScriptableSentryUnityOptions.cs @@ -228,7 +228,7 @@ internal SentryUnityOptions ToSentryUnityOptions( AddBreadcrumbsWithStructuredLogs = AddBreadcrumbsWithStructuredLogs }; - options.EnableMetrics = EnableMetrics; + options.Experimental.EnableMetrics = EnableMetrics; // By default, the cacheDirectoryPath gets set on known platforms. We're overwriting this behaviour here. if (!EnableOfflineCaching) diff --git a/src/Sentry.Unity/SentrySdk.Dotnet.cs b/src/Sentry.Unity/SentrySdk.Dotnet.cs index 3b2c55ace..2539aa3b2 100644 --- a/src/Sentry.Unity/SentrySdk.Dotnet.cs +++ b/src/Sentry.Unity/SentrySdk.Dotnet.cs @@ -54,20 +54,13 @@ public static partial class SentrySdk /// /// Gets the structured logger instance for creating and sending logs to Sentry. /// - /// - public static SentryStructuredLogger Logger { [DebuggerStepThrough] get => Sentry.SentrySdk.Logger; } - - /// - /// Generates and sends metrics to Sentry. - /// /// - /// Available options: - /// - /// - /// - /// + /// Use this property to access structured logging functionality. Logs are only sent when + /// 's + /// is set to true. /// - public static SentryMetricEmitter Metrics { [DebuggerStepThrough] get => Sentry.SentrySdk.Metrics; } + /// + public static SentryStructuredLogger Logger { [DebuggerStepThrough] get => Sentry.SentrySdk.Logger; } /// /// Creates a new scope that will terminate when disposed. @@ -553,4 +546,34 @@ public static void ResumeSession() /// [Obsolete("WARNING: This method deliberately causes a crash, and should not be used in a real application.")] public static void CauseCrash(CrashType crashType) => Sentry.SentrySdk.CauseCrash(crashType); + + /// + /// Sentry features that are currently in an experimental state. + /// + /// + /// Experimental features are subject to binary, source and behavioral breaking changes in future updates. + /// + public static ExperimentalSentrySdk Experimental { get; } = new(); + + /// + /// Sentry features that are currently in an experimental state. + /// + /// + /// Experimental features are subject to binary, source and behavioral breaking changes in future updates. + /// + public sealed class ExperimentalSentrySdk + { + internal ExperimentalSentrySdk() + { + } + + /// + /// Gets the metric emitter for emitting counters, gauges, and distributions connected to traces. + /// + public SentryMetricEmitter Metrics + { + [DebuggerStepThrough] + get => Sentry.SentrySdk.Experimental.Metrics; + } + } }