diff --git a/CHANGELOG.md b/CHANGELOG.md index f40327415..1271dd85f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,15 +2,19 @@ ## Unreleased +### Behavioural Changes and Deprecations + +- The `EnableMetrics` option is now marked as `[Obsolete]` and no longer has any effect, following the .NET SDK where metrics are always enabled. Disable the individual `Auto*Metrics` options instead, or filter emitted metrics with `SetBeforeSendMetric`. ([#2828](https://github.com/getsentry/sentry-unity/pull/2828)) + ### Fixes - IL2CPP line numbers now work on Android x86/x86_64 builds. il2cpp fails to report the image UUID there, so the SDK falls back to looking the debug image up by name ([#2817](https://github.com/getsentry/sentry-unity/pull/2817)) ### Dependencies -- Bump .NET SDK from v6.8.0 to v6.9.0 ([#2815](https://github.com/getsentry/sentry-unity/pull/2815)) - - [changelog](https://github.com/getsentry/sentry-dotnet/blob/main/CHANGELOG.md#690) - - [diff](https://github.com/getsentry/sentry-dotnet/compare/6.8.0...6.9.0) +- Bump .NET SDK from v6.8.0 to v6.10.0 ([#2815](https://github.com/getsentry/sentry-unity/pull/2815), [#2828](https://github.com/getsentry/sentry-unity/pull/2828)) + - [changelog](https://github.com/getsentry/sentry-dotnet/blob/main/CHANGELOG.md#6100) + - [diff](https://github.com/getsentry/sentry-dotnet/compare/6.8.0...6.10.0) - Bump Native SDK from v0.16.2 to v0.16.4 ([#2820](https://github.com/getsentry/sentry-unity/pull/2820)) - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0164) - [diff](https://github.com/getsentry/sentry-native/compare/0.16.2...0.16.4) diff --git a/global.json b/global.json index fccbd04e2..a7da7634b 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "10.0.302", - "workloadVersion": "10.0.302", + "version": "10.0.400", + "workloadVersion": "10.0.400", "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 d150ed5bb..6acad393f 100644 --- a/samples/unity-of-bugs/Assets/Resources/Sentry/SentryOptions.asset +++ b/samples/unity-of-bugs/Assets/Resources/Sentry/SentryOptions.asset @@ -88,7 +88,6 @@ MonoBehaviour: k__BackingField: 1 k__BackingField: 1 k__BackingField: 1 - k__BackingField: 1 k__BackingField: k__BackingField: 0 k__BackingField: 0 diff --git a/src/Sentry.Unity.Android/SentryJava.cs b/src/Sentry.Unity.Android/SentryJava.cs index c1db5e7dc..2599a51fb 100644 --- a/src/Sentry.Unity.Android/SentryJava.cs +++ b/src/Sentry.Unity.Android/SentryJava.cs @@ -156,11 +156,6 @@ public void Init(SentryUnityOptions options) logsOptions.Call("setEnabled", options.EnableLogs); } - using (var metricsOptions = androidOptions.Call("getMetrics")) - { - metricsOptions.Call("setEnabled", options.EnableMetrics); - } - // Options that are not to be set by the user // We're disabling some integrations as to not duplicate event or because the SDK relies on the .NET SDK // implementation of certain feature - i.e. Session Tracking diff --git a/src/Sentry.Unity.Editor/ConfigurationWindow/AdvancedTab.cs b/src/Sentry.Unity.Editor/ConfigurationWindow/AdvancedTab.cs index 241708c97..1d3225929 100644 --- a/src/Sentry.Unity.Editor/ConfigurationWindow/AdvancedTab.cs +++ b/src/Sentry.Unity.Editor/ConfigurationWindow/AdvancedTab.cs @@ -231,13 +231,6 @@ internal static void Display(ScriptableSentryUnityOptions options, SentryCliOpti { GUILayout.Label("Metrics", EditorStyles.boldLabel); - options.EnableMetrics = EditorGUILayout.BeginToggleGroup( - new GUIContent("Enable Metrics", - "Whether the SDK sends metrics to Sentry. " + - "Metrics are connected to traces for correlation."), - options.EnableMetrics); - EditorGUI.indentLevel++; - GUILayout.Label("EXPERIMENTAL: Auto-collect common game performance metrics and send them to Sentry.", EditorStyles.wordWrappedMiniLabel); @@ -305,9 +298,6 @@ internal static void Display(ScriptableSentryUnityOptions options, SentryCliOpti } EditorGUI.indentLevel--; EditorGUILayout.EndToggleGroup(); - - EditorGUI.indentLevel--; - EditorGUILayout.EndToggleGroup(); } EditorGUILayout.Space(); diff --git a/src/Sentry.Unity.Native/SentryNativeBridge.cs b/src/Sentry.Unity.Native/SentryNativeBridge.cs index 343521ed3..2cf71b471 100644 --- a/src/Sentry.Unity.Native/SentryNativeBridge.cs +++ b/src/Sentry.Unity.Native/SentryNativeBridge.cs @@ -108,9 +108,6 @@ is RuntimePlatform.WindowsPlayer or RuntimePlatform.WindowsServer Logger?.LogDebug("Setting EnableLogs: {0}", options.EnableLogs); sentry_options_set_enable_logs(cOptions, options.EnableLogs ? 1 : 0); - Logger?.LogDebug("Setting EnableMetrics: {0}", options.EnableMetrics); - sentry_options_set_enable_metrics(cOptions, options.EnableMetrics ? 1 : 0); - if (options.UnityInfo.IL2CPP) { Logger?.LogDebug("Setting the native logger"); @@ -204,9 +201,6 @@ internal static string GetDatabasePath(SentryUnityOptions options, IApplication? [DllImport(SentryLib)] private static extern void sentry_options_set_enable_logs(IntPtr options, int enable_logs); - [DllImport(SentryLib)] - private static extern void sentry_options_set_enable_metrics(IntPtr options, int enable_metrics); - [DllImport(SentryLib)] private static extern void sentry_options_set_enable_app_hang_tracking(IntPtr options, int enabled); diff --git a/src/Sentry.Unity.iOS/SentryCocoaBridgeProxy.cs b/src/Sentry.Unity.iOS/SentryCocoaBridgeProxy.cs index 23adb1c87..2f5596a5e 100644 --- a/src/Sentry.Unity.iOS/SentryCocoaBridgeProxy.cs +++ b/src/Sentry.Unity.iOS/SentryCocoaBridgeProxy.cs @@ -81,9 +81,6 @@ public static bool Init(SentryUnityOptions options) Logger?.LogDebug("Setting EnableLogs: {0}", options.EnableLogs); OptionsSetInt(cOptions, "enableLogs", options.EnableLogs ? 1 : 0); - Logger?.LogDebug("Setting EnableMetrics: {0}", options.EnableMetrics); - OptionsSetInt(cOptions, "enableMetrics", options.EnableMetrics ? 1 : 0); - foreach (var range in options.FailedRequestStatusCodes) { Logger?.LogDebug("Adding FailedRequestStatusCodeRange: {0}-{1}", range.Start, range.End); diff --git a/src/Sentry.Unity/Integrations/FrameTimeMetricsIntegration.cs b/src/Sentry.Unity/Integrations/FrameTimeMetricsIntegration.cs index 17fa41487..bea1c7286 100644 --- a/src/Sentry.Unity/Integrations/FrameTimeMetricsIntegration.cs +++ b/src/Sentry.Unity/Integrations/FrameTimeMetricsIntegration.cs @@ -24,13 +24,6 @@ public void Register(IHub hub, SentryOptions sentryOptions) return; } - if (!options.EnableMetrics) - { - options.DiagnosticLogger?.LogWarning( - "Frame-time metrics are enabled but 'EnableMetrics' is disabled. No metrics will be collected."); - return; - } - var monitor = new FrameTimeMonitor(options); var interval = options.FrameMetricsInterval < TimeSpan.FromSeconds(1) ? TimeSpan.FromSeconds(1) diff --git a/src/Sentry.Unity/Integrations/GameStatsMetricsIntegration.cs b/src/Sentry.Unity/Integrations/GameStatsMetricsIntegration.cs index 3c1a142e3..8c89c2d00 100644 --- a/src/Sentry.Unity/Integrations/GameStatsMetricsIntegration.cs +++ b/src/Sentry.Unity/Integrations/GameStatsMetricsIntegration.cs @@ -24,13 +24,6 @@ public void Register(IHub hub, SentryOptions sentryOptions) return; } - if (!options.EnableMetrics) - { - options.DiagnosticLogger?.LogWarning( - "Memory metrics are enabled but 'EnableMetrics' is disabled. No metrics will be collected."); - return; - } - var monitor = new GameStatsMonitor(options); var interval = options.MemoryMetricsInterval < TimeSpan.FromSeconds(1) ? TimeSpan.FromSeconds(1) diff --git a/src/Sentry.Unity/Integrations/GcMetricsIntegration.cs b/src/Sentry.Unity/Integrations/GcMetricsIntegration.cs index 26671608a..900aeed24 100644 --- a/src/Sentry.Unity/Integrations/GcMetricsIntegration.cs +++ b/src/Sentry.Unity/Integrations/GcMetricsIntegration.cs @@ -24,13 +24,6 @@ public void Register(IHub hub, SentryOptions sentryOptions) return; } - if (!options.EnableMetrics) - { - options.DiagnosticLogger?.LogWarning( - "GC metrics are enabled but 'EnableMetrics' is disabled. No metrics will be collected."); - return; - } - var monitor = new GcMonitor(options); var interval = options.GcMetricsInterval < TimeSpan.FromSeconds(1) ? TimeSpan.FromSeconds(1) diff --git a/src/Sentry.Unity/Integrations/NetworkMetricsIntegration.cs b/src/Sentry.Unity/Integrations/NetworkMetricsIntegration.cs index d21028871..a5dad6292 100644 --- a/src/Sentry.Unity/Integrations/NetworkMetricsIntegration.cs +++ b/src/Sentry.Unity/Integrations/NetworkMetricsIntegration.cs @@ -24,13 +24,6 @@ public void Register(IHub hub, SentryOptions sentryOptions) return; } - if (!options.EnableMetrics) - { - options.DiagnosticLogger?.LogWarning( - "Network metrics are enabled but 'EnableMetrics' is disabled. No metrics will be collected."); - return; - } - var monitor = new NetworkMetricsMonitor(options); if (!monitor.IsAvailable) { diff --git a/src/Sentry.Unity/ScriptableSentryUnityOptions.cs b/src/Sentry.Unity/ScriptableSentryUnityOptions.cs index 22ee78dd3..6bfb920f7 100644 --- a/src/Sentry.Unity/ScriptableSentryUnityOptions.cs +++ b/src/Sentry.Unity/ScriptableSentryUnityOptions.cs @@ -153,7 +153,17 @@ 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; + + /// + /// Metrics are always sent to Sentry. + /// + /// + /// This option no longer has any effect. The getter always returns and the + /// setter is ignored, matching in the .NET SDK. + /// + [Obsolete("Metrics are always enabled. This option is ignored and will be removed in a future version. Disable the individual Auto*Metrics options instead, or filter emitted metrics with SetBeforeSendMetric.")] + public bool EnableMetrics { get => true; set { } } + [field: SerializeField] public ExperimentalSentryUnityOptions Experimental { get; set; } = new(); [field: SerializeField] public SentryOptionsConfiguration? OptionsConfiguration { get; set; } @@ -264,7 +274,6 @@ internal SentryUnityOptions ToSentryUnityOptions( AddBreadcrumbsWithStructuredLogs = AddBreadcrumbsWithStructuredLogs }; - options.EnableMetrics = EnableMetrics; options.Experimental.MacosBackend = Experimental.MacosBackend; options.Experimental.WindowsBackend = Experimental.WindowsBackend; options.Experimental.LinuxBackend = Experimental.LinuxBackend; diff --git a/src/Sentry.Unity/SentryUnityOptions.cs b/src/Sentry.Unity/SentryUnityOptions.cs index 03af07038..1cb15ad5b 100644 --- a/src/Sentry.Unity/SentryUnityOptions.cs +++ b/src/Sentry.Unity/SentryUnityOptions.cs @@ -137,8 +137,7 @@ public sealed class SentryUnityOptions : SentryOptions /// /// EXPERIMENTAL: Automatically collect per-frame performance metrics, including frame time, FPS, - /// and CPU thread timings, and send them to Sentry as metrics. Requires to remain - /// enabled (the default). + /// and CPU thread timings, and send them to Sentry as metrics. /// public bool AutoFrameMetrics { get; set; } = false; @@ -149,7 +148,7 @@ public sealed class SentryUnityOptions : SentryOptions /// /// EXPERIMENTAL: Periodically collect memory usage and send it to Sentry as - /// metrics. Requires to remain enabled (the default). + /// metrics. /// public bool AutoMemoryMetrics { get; set; } = false; @@ -160,7 +159,7 @@ public sealed class SentryUnityOptions : SentryOptions /// /// EXPERIMENTAL: Periodically collect garbage-collection counts (per generation) and send them - /// to Sentry as metrics. Requires to remain enabled. + /// to Sentry as metrics. /// public bool AutoGcMetrics { get; set; } = false; @@ -172,7 +171,7 @@ public sealed class SentryUnityOptions : SentryOptions /// /// EXPERIMENTAL: Periodically collect basic multiplayer network metrics - round-trip time (on /// clients) and connected-client count (on the server) - and send them to Sentry as metrics. - /// Requires the Netcode for GameObjects package and . + /// Requires the Netcode for GameObjects package. /// public bool AutoNetworkMetrics { get; set; } = false; diff --git a/src/sentry-dotnet b/src/sentry-dotnet index 007c0b288..b5f25119b 160000 --- a/src/sentry-dotnet +++ b/src/sentry-dotnet @@ -1 +1 @@ -Subproject commit 007c0b288685ec89272cdd0f8ac176871ca141bb +Subproject commit b5f25119b5cbf39bd22c1a1874ea5d3b59481d58 diff --git a/test/Scripts.Integration.Test/Scripts/IntegrationOptionsConfiguration.cs b/test/Scripts.Integration.Test/Scripts/IntegrationOptionsConfiguration.cs index abd511677..f6afcc406 100644 --- a/test/Scripts.Integration.Test/Scripts/IntegrationOptionsConfiguration.cs +++ b/test/Scripts.Integration.Test/Scripts/IntegrationOptionsConfiguration.cs @@ -27,7 +27,6 @@ public override void Configure(SentryUnityOptions options) options.TracesSampleRate = 1.0d; options.EnableLogs = true; - options.EnableMetrics = true; // No custom HTTP handler -- events go to real sentry.io