From a7029ce74fb3d3df26f5b827537c9900bb9e9658 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Tue, 10 Feb 2026 16:59:31 +0100 Subject: [PATCH 1/2] Bumped to 6.1 --- Directory.Build.props | 1 + global.json | 4 +-- .../Resources/Sentry/SentryOptions.asset | 7 +++-- .../ConfigurationWindow/AdvancedTab.cs | 14 +++++++++ .../UnityApplicationLoggingIntegration.cs | 2 +- .../ScriptableSentryUnityOptions.cs | 3 ++ src/Sentry.Unity/SentrySdk.Dotnet.cs | 30 +++++++++++++++++++ src/sentry-dotnet | 2 +- test/Sentry.Unity.Tests/Stubs/TestHub.cs | 3 ++ 9 files changed, 59 insertions(+), 7 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 7699ea9d7..aa9e0cfc3 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,6 +9,7 @@ true strict false + $(NoWarn);SENTRYTRACECONNECTEDMETRICS diff --git a/global.json b/global.json index be464523b..4264d6fe6 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "10.0.100", - "workloadVersion": "10.0.100", + "version": "10.0.102", + "workloadVersion": "10.0.101.1", "rollForward": "disable", "allowPrerelease": false } diff --git a/samples/unity-of-bugs/Assets/Resources/Sentry/SentryOptions.asset b/samples/unity-of-bugs/Assets/Resources/Sentry/SentryOptions.asset index bc6558739..94646d096 100644 --- a/samples/unity-of-bugs/Assets/Resources/Sentry/SentryOptions.asset +++ b/samples/unity-of-bugs/Assets/Resources/Sentry/SentryOptions.asset @@ -11,7 +11,7 @@ MonoBehaviour: m_EditorHideFlags: 0 m_Script: {fileID: -668357930, guid: 43ec428a58422470fa764bdba9d9bc19, type: 3} m_Name: SentryOptions - m_EditorClassIdentifier: + m_EditorClassIdentifier: k__BackingField: 1 k__BackingField: https://e9ee299dbf554dfd930bc5f3c90d5d4b@o447951.ingest.us.sentry.io/4504604988538880 k__BackingField: 1 @@ -27,8 +27,8 @@ MonoBehaviour: k__BackingField: 0 k__BackingField: 1 k__BackingField: 30000 - k__BackingField: - k__BackingField: + k__BackingField: + k__BackingField: k__BackingField: 1 k__BackingField: 1 k__BackingField: 1 @@ -78,6 +78,7 @@ MonoBehaviour: k__BackingField: 1 k__BackingField: 1 k__BackingField: 1 + k__BackingField: 1 k__BackingField: {fileID: 11400000, guid: cea63afb7c75f429799422326f926abe, type: 2} k__BackingField: 1 k__BackingField: 0 diff --git a/src/Sentry.Unity.Editor/ConfigurationWindow/AdvancedTab.cs b/src/Sentry.Unity.Editor/ConfigurationWindow/AdvancedTab.cs index 1ac0e2b71..56d0c2e9e 100644 --- a/src/Sentry.Unity.Editor/ConfigurationWindow/AdvancedTab.cs +++ b/src/Sentry.Unity.Editor/ConfigurationWindow/AdvancedTab.cs @@ -190,5 +190,19 @@ internal static void Display(ScriptableSentryUnityOptions options, SentryCliOpti } } } + + EditorGUILayout.Space(); + EditorGUI.DrawRect(EditorGUILayout.GetControlRect(false, 1), Color.gray); + EditorGUILayout.Space(); + + { + GUILayout.Label("Metrics", EditorStyles.boldLabel); + + options.EnableMetrics = EditorGUILayout.Toggle( + new GUIContent("Enable Metrics", + "Whether the SDK sends metrics to Sentry. " + + "Metrics are connected to traces for correlation."), + options.EnableMetrics); + } } } diff --git a/src/Sentry.Unity/Integrations/UnityApplicationLoggingIntegration.cs b/src/Sentry.Unity/Integrations/UnityApplicationLoggingIntegration.cs index 7d8d5b227..08b8749ba 100644 --- a/src/Sentry.Unity/Integrations/UnityApplicationLoggingIntegration.cs +++ b/src/Sentry.Unity/Integrations/UnityApplicationLoggingIntegration.cs @@ -154,7 +154,7 @@ private void ProcessStructuredLog(string message, LogType logType) _options.LogDebug("Capturing structured log message of type '{0}'.", logType); - SentryLog.GetTraceIdAndSpanId(_hub, out var traceId, out var spanId); + _hub.GetTraceIdAndSpanId(out var traceId, out var spanId); SentryLog log = new(_clock.GetUtcNow(), traceId, ToLogLevel(logType), message) { SpanId = spanId }; log.SetDefaultAttributes(_options, UnitySdkInfo.Sdk); diff --git a/src/Sentry.Unity/ScriptableSentryUnityOptions.cs b/src/Sentry.Unity/ScriptableSentryUnityOptions.cs index 5c9386e6d..5c3385199 100644 --- a/src/Sentry.Unity/ScriptableSentryUnityOptions.cs +++ b/src/Sentry.Unity/ScriptableSentryUnityOptions.cs @@ -130,6 +130,7 @@ public static string GetConfigPath(string? notDefaultConfigName = null) [field: SerializeField] public bool PlayStationNativeSupportEnabled { get; set; } = true; [field: SerializeField] public bool SwitchNativeSupportEnabled { get; set; } = true; [field: SerializeField] public bool Il2CppLineNumberSupportEnabled { get; set; } = true; + [field: SerializeField] public bool EnableMetrics { get; set; } = true; [field: SerializeField] public SentryOptionsConfiguration? OptionsConfiguration { get; set; } [field: SerializeField] public bool Debug { get; set; } = true; @@ -227,6 +228,8 @@ internal SentryUnityOptions ToSentryUnityOptions( AddBreadcrumbsWithStructuredLogs = AddBreadcrumbsWithStructuredLogs }; + 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 1248f3a11..1d82975d9 100644 --- a/src/Sentry.Unity/SentrySdk.Dotnet.cs +++ b/src/Sentry.Unity/SentrySdk.Dotnet.cs @@ -530,4 +530,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; + } + } } diff --git a/src/sentry-dotnet b/src/sentry-dotnet index 7fceb6d2a..3a426e03f 160000 --- a/src/sentry-dotnet +++ b/src/sentry-dotnet @@ -1 +1 @@ -Subproject commit 7fceb6d2a2546a480a7112680596c7215e2ed356 +Subproject commit 3a426e03f2bdd54b459ff5d2ba634d506e46e36e diff --git a/test/Sentry.Unity.Tests/Stubs/TestHub.cs b/test/Sentry.Unity.Tests/Stubs/TestHub.cs index 306ac3ce6..accbe8d3c 100644 --- a/test/Sentry.Unity.Tests/Stubs/TestHub.cs +++ b/test/Sentry.Unity.Tests/Stubs/TestHub.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; +using Sentry.Internal; using Sentry.Protocol.Envelopes; namespace Sentry.Unity.Tests.Stubs; @@ -124,6 +125,8 @@ public void WithScope(Action scopeCallback) public SentryStructuredLogger Logger { get; } #pragma warning restore SENTRY0001 + public SentryMetricEmitter Metrics => DisabledSentryMetricEmitter.Instance; + public ITransactionTracer StartTransaction(ITransactionContext context, IReadOnlyDictionary customSamplingContext) => new TransactionTracer(this, context); From 312ece625e1add6a1687d842bf8d241bd66b6fd9 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Tue, 10 Feb 2026 17:10:24 +0100 Subject: [PATCH 2/2] Updated CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca8550576..cc6e009a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Features +- [Sentry trace-connected Metrics](https://docs.sentry.io/product/explore/metrics/) are now available as _experimental_. ([#2533](https://github.com/getsentry/sentry-unity/pull/2533)) - Added content-based error event throttling to prevent repeated errors from consuming quota. The new `IThrottler` interface and `ErrorEventThrottler` implementation deduplicate `LogError`, `LogException`, and `LogAssertion` events based on message + stacktrace fingerprinting. Configurable via the Editor window ("Enable Error Event Throttling" + "Dedupe Window"). Breadcrumbs and structured logs are not affected by default. ([#2479](https://github.com/getsentry/sentry-unity/pull/2479)) ### Deprecations @@ -29,6 +30,9 @@ ### Dependencies +- Bump .NET SDK from v6.0.0 to v6.1.0 ([#2533](https://github.com/getsentry/sentry-unity/pull/2533)) + - [changelog](https://github.com/getsentry/sentry-dotnet/blob/main/CHANGELOG.md#610) + - [diff](https://github.com/getsentry/sentry-dotnet/compare/6.0.0...6.1.0) - Bump Java SDK from v8.28.0 to v8.31.0 ([#2462](https://github.com/getsentry/sentry-unity/pull/2462), [#2481](https://github.com/getsentry/sentry-unity/pull/2481), [#2493](https://github.com/getsentry/sentry-unity/pull/2493)) - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#8310) - [diff](https://github.com/getsentry/sentry-java/compare/8.28.0...8.31.0)