From d4cd9c461a22cf8fe8a3b5c5274d24d92aba6a2a Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Mon, 22 Jun 2026 13:29:19 +0200 Subject: [PATCH 1/4] docs(godot): Document Metrics general availability in SDK 2.0.0 Metrics are generally available and supported on all platforms (including Apple) as of Godot SDK 2.0.0. The enable_metrics and before_send_metric options moved out of the experimental namespace onto SentryOptions. - Remove the note that metrics aren't supported on Apple platforms - Update the Project Settings path from Sentry > Experimental to Sentry > Options - Drop the experimental labels and experimental.* option paths - Bump the requirements note to 2.0.0 (previously experimental since 1.4.0) - Document enable_metrics and before_send_metric on the general options reference Refs getsentry/sentry-godot#755 Co-Authored-By: Claude Opus 4.8 (1M context) --- .../platforms/godot/configuration/options.mdx | 42 +++++++++++++++++++ platform-includes/metrics/options/godot.mdx | 10 ++--- .../metrics/requirements/godot.mdx | 2 +- platform-includes/metrics/setup/godot.mdx | 9 +--- 4 files changed, 50 insertions(+), 13 deletions(-) diff --git a/docs/platforms/godot/configuration/options.mdx b/docs/platforms/godot/configuration/options.mdx index 0ecf1e7d0cf5a..d288734992f04 100644 --- a/docs/platforms/godot/configuration/options.mdx +++ b/docs/platforms/godot/configuration/options.mdx @@ -280,6 +280,16 @@ This option contains multiple properties that govern the behavior of throttling. +## Metrics Options + + + +If `true`, enables Sentry metrics functionality, allowing you to emit custom counters, gauges, and distributions through `SentrySDK.metrics`. See Set Up Metrics for usage details. + +This option is turned on by default. + + + ## Hooks These options can be used to hook the SDK in various ways to customize the reporting of events. @@ -384,6 +394,38 @@ options.SetBeforeSendLog(log => + + +If assigned, this callback runs before a metric is sent to Sentry. +It can be used to modify the metric or prevent it from being sent. +It takes a `SentryMetric` as a parameter and returns either the same metric object, with or without modifications, or `null` to discard it. + +```gdscript {tabTitle:GDScript} {mdExpandTabs} +func _before_send_metric(metric: SentryMetric) -> SentryMetric: + # Drop debug-only metrics in release builds. + if not OS.is_debug_build() and metric.name.begins_with("debug."): + return null + # Enrich with runtime context. + metric.set_attribute("current_scene", get_tree().current_scene.name) + return metric +``` + +```csharp {tabTitle:C#} +options.SetBeforeSendMetric(metric => +{ + // Drop debug-only metrics in release builds. + if (!OS.IsDebugBuild() && metric.Name.StartsWith("debug.")) + { + return null; + } + // Enrich with runtime context. + metric.SetAttribute("current_scene", GetTree().CurrentScene.Name); + return metric; +}); +``` + + + ## Native Hooks in C# In C#, hook methods set directly on `options` apply to managed SDK data, such as events and logs from your game's C# code and third-party .NET libraries. However, much of the Godot SDK's processing happens in the native C++ layer, including events and logs captured from the engine, GDScript, and GDExtension code. Native hook methods live under `options.Native`; use these callbacks to inspect, modify, or drop native data before it's sent to Sentry. diff --git a/platform-includes/metrics/options/godot.mdx b/platform-includes/metrics/options/godot.mdx index ff4b9fdadfdf1..4ae44c86a12d5 100644 --- a/platform-includes/metrics/options/godot.mdx +++ b/platform-includes/metrics/options/godot.mdx @@ -1,9 +1,9 @@ The following configuration options are available for Sentry's [Application Metrics](/product/explore/metrics/) in Godot Engine: -| Option | Description | Default | -| ---------------------- | ------------------------------------------------------------------ | ------- | -| **enable_metrics** | Toggle for the metrics feature (experimental) | `true` | -| **before_send_metric** | Callback to modify or filter metrics before sending (experimental) | None | +| Option | Description | Default | +| ---------------------- | --------------------------------------------------- | ------- | +| **enable_metrics** | Toggle for the metrics feature | `true` | +| **before_send_metric** | Callback to modify or filter metrics before sending | None | ### before_send_metric @@ -11,7 +11,7 @@ To filter metrics or modify them before they are sent to Sentry, you can use the ```gdscript {tabTitle:GDScript} {mdExpandTabs} SentrySDK.init(func(options: SentryOptions) -> void: - options.experimental.before_send_metric = _before_send_metric + options.before_send_metric = _before_send_metric ) func _before_send_metric(metric: SentryMetric) -> SentryMetric: diff --git a/platform-includes/metrics/requirements/godot.mdx b/platform-includes/metrics/requirements/godot.mdx index 67548f5162cfd..eef240539e721 100644 --- a/platform-includes/metrics/requirements/godot.mdx +++ b/platform-includes/metrics/requirements/godot.mdx @@ -1 +1 @@ -Metrics for Godot Engine are supported in Sentry Godot SDK version `1.4.0` and above. +Metrics for Godot Engine are supported in Sentry Godot SDK version `2.0.0` and above (previously experimental since `1.4.0`). diff --git a/platform-includes/metrics/setup/godot.mdx b/platform-includes/metrics/setup/godot.mdx index 64465d84fb607..581422b09b05d 100644 --- a/platform-includes/metrics/setup/godot.mdx +++ b/platform-includes/metrics/setup/godot.mdx @@ -1,13 +1,8 @@ Metrics are enabled by default in the Sentry Godot SDK. No additional setup is required to start sending metrics. - - Adding metrics from GDScript isn't supported on Apple platforms yet (macOS and iOS). - The first attempt to use metrics on these platforms will result in a warning. - - ### Project Settings Configuration -To disable metrics, navigate to **Project Settings > Sentry > Experimental** and uncheck the **Enable Metrics** option. +To disable metrics, navigate to **Project Settings > Sentry > Options** and uncheck the **Enable Metrics** option. ### Programmatic Configuration @@ -15,7 +10,7 @@ Alternatively, you can disable metrics programmatically when initializing the SD ```gdscript {tabTitle:GDScript} {mdExpandTabs} SentrySDK.init(func(options: SentryOptions) -> void: - options.experimental.enable_metrics = false + options.enable_metrics = false ) ``` From 4d24a6180e0214776eb94866e4042ad43cd57738 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Mon, 22 Jun 2026 13:31:51 +0200 Subject: [PATCH 2/4] docs(godot): Group before_send hooks with their feature options Move before_send_metric next to enable_metrics under Metrics Options, and before_send_log next to enable_logs under Logging Options, instead of listing them under the general Hooks section. This groups each feature's toggle and its before-send hook together, matching how the Apple SDK documents metric and log hooks, and keeps the two data hooks consistent with each other. The Hooks section now covers only the event-level hooks (before_send, before_capture_screenshot). Refs getsentry/sentry-godot#755 Co-Authored-By: Claude Opus 4.8 (1M context) --- .../platforms/godot/configuration/options.mdx | 132 +++++++++--------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/docs/platforms/godot/configuration/options.mdx b/docs/platforms/godot/configuration/options.mdx index d288734992f04..bd74f381db93c 100644 --- a/docs/platforms/godot/configuration/options.mdx +++ b/docs/platforms/godot/configuration/options.mdx @@ -182,6 +182,40 @@ This option is turned off by default. + + +If assigned, this callback will be called before sending a log message to Sentry. +It can be used to modify the log message or prevent it from being sent. + +```gdscript {tabTitle:GDScript} {mdExpandTabs} +func _before_send_log(log_entry: SentryLog) -> SentryLog: + # Filter junk. + if log_entry.body == "Junk message": + return null + # Remove sensitive information from log messages. + log_entry.body = log_entry.body.replace("Bruno", "REDACTED") + # Add custom attributes. + log_entry.set_attribute("current_scene", current_scene.name) + return log_entry +``` + +```csharp {tabTitle:C#} +// The .NET hook applies to logs emitted from your C# code. +options.SetBeforeSendLog(log => +{ + // Filter junk. + if (log.Message == "Junk message") + { + return null; + } + // Add custom attributes. + log.SetAttribute("current_scene", currentScene.Name); + return log; +}); +``` + + + ## Godot Logger Options @@ -290,6 +324,38 @@ This option is turned on by default. + + +If assigned, this callback runs before a metric is sent to Sentry. +It can be used to modify the metric or prevent it from being sent. +It takes a `SentryMetric` as a parameter and returns either the same metric object, with or without modifications, or `null` to discard it. + +```gdscript {tabTitle:GDScript} {mdExpandTabs} +func _before_send_metric(metric: SentryMetric) -> SentryMetric: + # Drop debug-only metrics in release builds. + if not OS.is_debug_build() and metric.name.begins_with("debug."): + return null + # Enrich with runtime context. + metric.set_attribute("current_scene", get_tree().current_scene.name) + return metric +``` + +```csharp {tabTitle:C#} +options.SetBeforeSendMetric(metric => +{ + // Drop debug-only metrics in release builds. + if (!OS.IsDebugBuild() && metric.Name.StartsWith("debug.")) + { + return null; + } + // Enrich with runtime context. + metric.SetAttribute("current_scene", GetTree().CurrentScene.Name); + return metric; +}); +``` + + + ## Hooks These options can be used to hook the SDK in various ways to customize the reporting of events. @@ -360,72 +426,6 @@ This callback isn't available in the .NET layer yet, so it can only be set from - - -If assigned, this callback will be called before sending a log message to Sentry. -It can be used to modify the log message or prevent it from being sent. - -```gdscript {tabTitle:GDScript} {mdExpandTabs} -func _before_send_log(log_entry: SentryLog) -> SentryLog: - # Filter junk. - if log_entry.body == "Junk message": - return null - # Remove sensitive information from log messages. - log_entry.body = log_entry.body.replace("Bruno", "REDACTED") - # Add custom attributes. - log_entry.set_attribute("current_scene", current_scene.name) - return log_entry -``` - -```csharp {tabTitle:C#} -// The .NET hook applies to logs emitted from your C# code. -options.SetBeforeSendLog(log => -{ - // Filter junk. - if (log.Message == "Junk message") - { - return null; - } - // Add custom attributes. - log.SetAttribute("current_scene", currentScene.Name); - return log; -}); -``` - - - - - -If assigned, this callback runs before a metric is sent to Sentry. -It can be used to modify the metric or prevent it from being sent. -It takes a `SentryMetric` as a parameter and returns either the same metric object, with or without modifications, or `null` to discard it. - -```gdscript {tabTitle:GDScript} {mdExpandTabs} -func _before_send_metric(metric: SentryMetric) -> SentryMetric: - # Drop debug-only metrics in release builds. - if not OS.is_debug_build() and metric.name.begins_with("debug."): - return null - # Enrich with runtime context. - metric.set_attribute("current_scene", get_tree().current_scene.name) - return metric -``` - -```csharp {tabTitle:C#} -options.SetBeforeSendMetric(metric => -{ - // Drop debug-only metrics in release builds. - if (!OS.IsDebugBuild() && metric.Name.StartsWith("debug.")) - { - return null; - } - // Enrich with runtime context. - metric.SetAttribute("current_scene", GetTree().CurrentScene.Name); - return metric; -}); -``` - - - ## Native Hooks in C# In C#, hook methods set directly on `options` apply to managed SDK data, such as events and logs from your game's C# code and third-party .NET libraries. However, much of the Godot SDK's processing happens in the native C++ layer, including events and logs captured from the engine, GDScript, and GDExtension code. Native hook methods live under `options.Native`; use these callbacks to inspect, modify, or drop native data before it's sent to Sentry. From 85471ef4f1d638cec853089918a8d7ab0de3c731 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Mon, 22 Jun 2026 13:57:04 +0200 Subject: [PATCH 3/4] Move Metrics Options next to Logging Options --- .../platforms/godot/configuration/options.mdx | 84 +++++++++---------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/docs/platforms/godot/configuration/options.mdx b/docs/platforms/godot/configuration/options.mdx index bd74f381db93c..9972e23f55f61 100644 --- a/docs/platforms/godot/configuration/options.mdx +++ b/docs/platforms/godot/configuration/options.mdx @@ -216,6 +216,48 @@ options.SetBeforeSendLog(log => +## Metrics Options + + + +If `true`, enables Sentry metrics functionality, allowing you to emit custom counters, gauges, and distributions through `SentrySDK.metrics`. See Set Up Metrics for usage details. + +This option is turned on by default. + + + + + +If assigned, this callback runs before a metric is sent to Sentry. +It can be used to modify the metric or prevent it from being sent. +It takes a `SentryMetric` as a parameter and returns either the same metric object, with or without modifications, or `null` to discard it. + +```gdscript {tabTitle:GDScript} {mdExpandTabs} +func _before_send_metric(metric: SentryMetric) -> SentryMetric: + # Drop debug-only metrics in release builds. + if not OS.is_debug_build() and metric.name.begins_with("debug."): + return null + # Enrich with runtime context. + metric.set_attribute("current_scene", get_tree().current_scene.name) + return metric +``` + +```csharp {tabTitle:C#} +options.SetBeforeSendMetric(metric => +{ + // Drop debug-only metrics in release builds. + if (!OS.IsDebugBuild() && metric.Name.StartsWith("debug.")) + { + return null; + } + // Enrich with runtime context. + metric.SetAttribute("current_scene", GetTree().CurrentScene.Name); + return metric; +}); +``` + + + ## Godot Logger Options @@ -314,48 +356,6 @@ This option contains multiple properties that govern the behavior of throttling. -## Metrics Options - - - -If `true`, enables Sentry metrics functionality, allowing you to emit custom counters, gauges, and distributions through `SentrySDK.metrics`. See Set Up Metrics for usage details. - -This option is turned on by default. - - - - - -If assigned, this callback runs before a metric is sent to Sentry. -It can be used to modify the metric or prevent it from being sent. -It takes a `SentryMetric` as a parameter and returns either the same metric object, with or without modifications, or `null` to discard it. - -```gdscript {tabTitle:GDScript} {mdExpandTabs} -func _before_send_metric(metric: SentryMetric) -> SentryMetric: - # Drop debug-only metrics in release builds. - if not OS.is_debug_build() and metric.name.begins_with("debug."): - return null - # Enrich with runtime context. - metric.set_attribute("current_scene", get_tree().current_scene.name) - return metric -``` - -```csharp {tabTitle:C#} -options.SetBeforeSendMetric(metric => -{ - // Drop debug-only metrics in release builds. - if (!OS.IsDebugBuild() && metric.Name.StartsWith("debug.")) - { - return null; - } - // Enrich with runtime context. - metric.SetAttribute("current_scene", GetTree().CurrentScene.Name); - return metric; -}); -``` - - - ## Hooks These options can be used to hook the SDK in various ways to customize the reporting of events. From f50c30d4231da8eb2986f66dcc2dc4d89114fc46 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Mon, 22 Jun 2026 15:08:14 +0200 Subject: [PATCH 4/4] Update docs/platforms/godot/configuration/options.mdx Co-authored-by: JoshuaMoelans <60878493+JoshuaMoelans@users.noreply.github.com> --- docs/platforms/godot/configuration/options.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/godot/configuration/options.mdx b/docs/platforms/godot/configuration/options.mdx index 9972e23f55f61..05c92eca37ed7 100644 --- a/docs/platforms/godot/configuration/options.mdx +++ b/docs/platforms/godot/configuration/options.mdx @@ -220,7 +220,7 @@ options.SetBeforeSendLog(log => -If `true`, enables Sentry metrics functionality, allowing you to emit custom counters, gauges, and distributions through `SentrySDK.metrics`. See Set Up Metrics for usage details. +If `true`, enables [Sentry's Application Metrics](https://docs.sentry.io/product/explore/metrics/) functionality, allowing you to emit custom counters, gauges, and distributions through `SentrySDK.metrics`. See Set Up Metrics for usage details. This option is turned on by default.