diff --git a/CHANGELOG.md b/CHANGELOG.md index 90c302f6c..19f8d0fc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,6 @@ ## Unreleased -### Features - -- 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 - The time-based log debouncing system (`TimeDebounceBase`, `LogTimeDebounce`, `ErrorTimeDebounce`, `WarningTimeDebounce`) and related options (`EnableLogDebouncing`, `DebounceTimeLog`, `DebounceTimeWarning`, `DebounceTimeError`) are now marked as `[Obsolete]`. Use the new content-based event throttling instead. ([#2479](https://github.com/getsentry/sentry-unity/pull/2479)) @@ -26,12 +22,17 @@ ### Features - Added Nintendo Switch Native Support. The SDK now automatically syncs the scope - tags, breadcrumbs, context - to the native layer, so native crashes have the same rich context as managed events. ([#2503](https://github.com/getsentry/sentry-unity/pull/2503)) +- [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)) ### Dependencies -- Bump Java SDK from v8.28.0 to v8.32.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), [#2530](https://github.com/getsentry/sentry-unity/pull/2530)) - - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#8320) - - [diff](https://github.com/getsentry/sentry-java/compare/8.28.0...8.32.0) +- 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) - Bump Native SDK from v0.12.2 to v0.12.6 ([#2471](https://github.com/getsentry/sentry-unity/pull/2471), [#2505](https://github.com/getsentry/sentry-unity/pull/2505), [#2512](https://github.com/getsentry/sentry-unity/pull/2512), [#2524](https://github.com/getsentry/sentry-unity/pull/2524)) - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0126) - [diff](https://github.com/getsentry/sentry-native/compare/0.12.2...0.12.6) 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);