From 319219eb2c4927a3b79edc62c546623c7da49cf3 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Fri, 7 Feb 2025 10:23:24 +0100 Subject: [PATCH 01/27] feat: Generate GDExtension documentation --- .gitignore | 1 + SConstruct | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index eefa952c..34da4d19 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ project/export_presets.cfg project/.vscode src/sdk_version.gen.h +src/gen/doc_data.gen.cpp # Godot auto generated files project/.godot/ diff --git a/SConstruct b/SConstruct index 70e0940d..6b71325f 100644 --- a/SConstruct +++ b/SConstruct @@ -224,6 +224,14 @@ sources += Glob("src/sentry/*.cpp") if env["platform"] in ["linux", "windows", "macos"]: sources += Glob("src/sentry/native/*.cpp") +# Generate documentation data. +if env["target"] in ["editor", "template_debug"]: + try: + doc_data = env.GodotCPPDocData("src/gen/doc_data.gen.cpp", source=Glob("doc_classes/*.xml")) + sources.append(doc_data) + except AttributeError: + print("Not including class reference as we're targeting a pre-4.3 baseline.") + build_type = "release" if env["target"] == "template_release" else "debug" if env["platform"] == "macos": From c93143db82879c72350a197318ab8c1cd498fb56 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Fri, 7 Feb 2025 10:23:34 +0100 Subject: [PATCH 02/27] Initial structure --- doc_classes/SentryConfiguration.xml | 17 +++++ doc_classes/SentryEvent.xml | 50 ++++++++++++ doc_classes/SentryLoggerLimits.xml | 19 +++++ doc_classes/SentryOptions.xml | 59 ++++++++++++++ doc_classes/SentrySDK.xml | 114 ++++++++++++++++++++++++++++ doc_classes/SentryUser.xml | 36 +++++++++ 6 files changed, 295 insertions(+) create mode 100644 doc_classes/SentryConfiguration.xml create mode 100644 doc_classes/SentryEvent.xml create mode 100644 doc_classes/SentryLoggerLimits.xml create mode 100644 doc_classes/SentryOptions.xml create mode 100644 doc_classes/SentrySDK.xml create mode 100644 doc_classes/SentryUser.xml diff --git a/doc_classes/SentryConfiguration.xml b/doc_classes/SentryConfiguration.xml new file mode 100644 index 00000000..bcd3f6dc --- /dev/null +++ b/doc_classes/SentryConfiguration.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/doc_classes/SentryEvent.xml b/doc_classes/SentryEvent.xml new file mode 100644 index 00000000..a49a555b --- /dev/null +++ b/doc_classes/SentryEvent.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc_classes/SentryLoggerLimits.xml b/doc_classes/SentryLoggerLimits.xml new file mode 100644 index 00000000..61d665a8 --- /dev/null +++ b/doc_classes/SentryLoggerLimits.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/doc_classes/SentryOptions.xml b/doc_classes/SentryOptions.xml new file mode 100644 index 00000000..9c12cbe8 --- /dev/null +++ b/doc_classes/SentryOptions.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc_classes/SentrySDK.xml b/doc_classes/SentrySDK.xml new file mode 100644 index 00000000..c8744504 --- /dev/null +++ b/doc_classes/SentrySDK.xml @@ -0,0 +1,114 @@ + + + + Entry point to Sentry SDK for Godot Engine. + + + Provides a set of functions to log errors and events to Sentry and enrich them with tags, breadcrumbs and arbitrary context. + + + + + + + + + + + + + Adds a breadcrumb to the next event. + TODO: explain breadcrumb. + + + + + + + Captures [param event] and sends it to Sentry, returning the event ID. You can create an event with [method SentrySDK.create_event]. + + + + + + + + + Captures an event with [param message] and sends it to Sentry, returning the event ID. + + + + + + Creates a new [SentryEvent] object. You can capture the event with [method SentrySDK.capture_event]. + + + + + + Returns the ID of the last captured event. + + + + + + Returns the current user. See [SentryUser]. + + + + + + Returns whether the SDK is enabled, i.e. whether the SDK is initialized and active. + + + + + + + Removes a tag with the specified [param key]. + + + + + + Removes user data previously set with [method SentrySDK.set_user]. + + + + + + + + Adds a custom context with the specified [param key] and [param value]. [param value] should be a dictionary with String keys. It can have multiple levels of nesting. + + + + + + + + Assigns a tag with the specified [param key] and [param value]. + + + + + + + Assigns user data. See [SentryUser]. + + + + + + + + + + + + + + This is the highest level and is used for events that led to the application crashing. + + + diff --git a/doc_classes/SentryUser.xml b/doc_classes/SentryUser.xml new file mode 100644 index 00000000..1caa4cf7 --- /dev/null +++ b/doc_classes/SentryUser.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 5a133ae5f07b5991c46fdd0ddd0eba08aa9d8cf2 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Mon, 10 Feb 2025 12:20:21 +0100 Subject: [PATCH 03/27] Fixes --- doc_classes/SentrySDK.xml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/doc_classes/SentrySDK.xml b/doc_classes/SentrySDK.xml index c8744504..98f1bc66 100644 --- a/doc_classes/SentrySDK.xml +++ b/doc_classes/SentrySDK.xml @@ -17,8 +17,7 @@ - Adds a breadcrumb to the next event. - TODO: explain breadcrumb. + Adds a breadcrumb to the next event. Sentry uses breadcrumbs to create a trail of events that happened prior to an issue. @@ -52,26 +51,26 @@ - Returns the current user. See [SentryUser]. + Returns the currently set user. See [SentryUser]. - Returns whether the SDK is enabled, i.e. whether the SDK is initialized and active. + Returns whether the SDK is enabled, i.e. whether it is initialized and active. - Removes a tag with the specified [param key]. + Removes the tag with the specified [param key]. - Removes user data previously set with [method SentrySDK.set_user]. + Removes the user data previously set with [method SentrySDK.set_user]. @@ -79,7 +78,7 @@ - Adds a custom context with the specified [param key] and [param value]. [param value] should be a dictionary with String keys. It can have multiple levels of nesting. + Adds a custom context with the specified [parameter key] and [parameter value]. The [parameter value] should be a dictionary with string keys and can have multiple levels of nesting. From bc0ebff6ee1c883bfba66dd5e3c389062e66a401 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Mon, 10 Feb 2025 13:40:52 +0100 Subject: [PATCH 04/27] Add SentryUser reference --- doc_classes/SentryUser.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc_classes/SentryUser.xml b/doc_classes/SentryUser.xml index 1caa4cf7..ed260c40 100644 --- a/doc_classes/SentryUser.xml +++ b/doc_classes/SentryUser.xml @@ -1,8 +1,11 @@ + Represents user data in Sentry. + Users consist of a few critical pieces of information that construct a unique identity in Sentry. Each of the properties is optional, but one [b]must[/b] be present for the Sentry SDK to capture the user. + If no user data is set using [method SentrySDK.set_user], the SDK falls back to a generated ID, which the SDK randomly generates once for each installation. Additionally, if [member SentryOptions.send_default_pii] is [code]true[/code], Sentry will infer the IP address from the connection between your game and Sentry's server. @@ -10,27 +13,35 @@ + Generates a new ID for the user. + Infer the IP address of the user. This method sets [member ip_address] to [code]{{auto}}[/code]. + Returns [code]true[/code] if the user data is empty. + An alternative, or addition, to the username. Sentry is aware of email addresses and can display things such as Gravatars and unlock messaging capabilities. + Your internal identifier for the user. Can be generated with [method generate_new_id]. + If you don't provide an ID, the SDK falls back to installation ID, which the SDK randomly generates once for each installation. + User IP address. If set to [code]{{auto}}[/code], Sentry will infer the IP address from the connection between your app and Sentry's server. + The username. Typically used as a better label than the internal ID. From de9d1e79094d1433076a38426eb62a49c515efe9 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Mon, 10 Feb 2025 13:48:24 +0100 Subject: [PATCH 05/27] Small fixes --- doc_classes/SentryUser.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc_classes/SentryUser.xml b/doc_classes/SentryUser.xml index ed260c40..96b7fd59 100644 --- a/doc_classes/SentryUser.xml +++ b/doc_classes/SentryUser.xml @@ -19,7 +19,7 @@ - Infer the IP address of the user. This method sets [member ip_address] to [code]{{auto}}[/code]. + Infers the user's IP address. This method sets [member ip_address] to [code]{{auto}}[/code]. From a53c8f426b8ea97216fab777ecee6b5a6cb3443c Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Mon, 10 Feb 2025 15:16:17 +0100 Subject: [PATCH 06/27] Add SentryEvent doc --- doc_classes/SentryEvent.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doc_classes/SentryEvent.xml b/doc_classes/SentryEvent.xml index a49a555b..aa3ae799 100644 --- a/doc_classes/SentryEvent.xml +++ b/doc_classes/SentryEvent.xml @@ -3,6 +3,8 @@ + Events are the core data sent by SDKs to the Sentry server. An event consists of simple data properties that capture key details about an occurrence. Typically, an event represents an error or exception and corresponds to a single transmission of data to the Sentry server. Events show up as issues on your issue stream, with the [member message] as the issue name. + [SentryEvent] can be created with the [method SentrySDK.create_event] method. @@ -11,12 +13,14 @@ + Returns the value of the tag with the specified [param key]. + Removes the tag with the specified [param key]. @@ -24,27 +28,38 @@ + Sets a tag with the specified [param key] to the given [param value]. + The application's distribution. Defaults to the value set in [member SentryOptions.dist]. + Distributions are used to disambiguate build or deployment variants of the same release of an application. + Hexadecimal string representing a UUID version 4 value. Automatically set by the SDK. + The record severity level of the event. Defaults to [code]LEVEL_ERROR[/code]. See [enum SentrySDK.Level]. + The name of the logger which created the record. + The log message that describes an event or error. + Represents the platform the SDK is submitting from. Automatically set by the SDK. + The release version of the application. Defaults to a value based on [member SentryOptions.release] option. + Release versions must be unique across all projects in your organization. This value can be the Git SHA for the given project, or a product identifier with a semantic version (suggested format my-game@1.0.0). + Indicates when the event was created in the Sentry SDK. Automatically set by the SDK. From 4c41a0a5e69ef948bb42f4f0400ab75032f5dcb8 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Mon, 10 Feb 2025 15:16:47 +0100 Subject: [PATCH 07/27] Expand on SDK information gathered from official docs --- doc_classes/SentrySDK.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc_classes/SentrySDK.xml b/doc_classes/SentrySDK.xml index 98f1bc66..fea9f4ef 100644 --- a/doc_classes/SentrySDK.xml +++ b/doc_classes/SentrySDK.xml @@ -5,6 +5,10 @@ Provides a set of functions to log errors and events to Sentry and enrich them with tags, breadcrumbs and arbitrary context. + Sentry SDK hooks into Godot's logging and automatically reports errors. An [b]event[/b] is one instance of sending data to Sentry. Generally, this data is an error or exception. + While capturing an event, you can also record the [b]breadcrumbs[/b] that lead up to that event. Breadcrumbs are different from events: they will not create an event in Sentry, but will be buffered until the next event is sent. Breadcrumbs can be captured with [method SentrySDK.add_breadcrumb] method. Learn more about breadcrumbs in our [url=https://docs.sentry.io/platforms/godot/enriching-events/breadcrumbs/]Godot SDK documentation[/url]. + Another common operation is to capture a bare message. A [b]message[/b] is textual information that should be sent to Sentry. Typically, our SDKs don't automatically capture messages, but you can capture them manually. Messages show up as issues on your issue stream, with the message as the issue name. To simplify creating events, there are shorthand functions that construct and capture prepopulated event objects. The most important one is [method SentrySDK.capture_message]. + For more information, see [url=https://docs.sentry.io/platforms/godot/]Godot SDK documentation[/url]. @@ -78,7 +82,7 @@ - Adds a custom context with the specified [parameter key] and [parameter value]. The [parameter value] should be a dictionary with string keys and can have multiple levels of nesting. + Adds a custom context with the specified [param key] and [param value]. The [param value] should be a dictionary with string keys and can have multiple levels of nesting. From 8d4f05e740c5801477c04eaeed1b3e956f0071f3 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Tue, 11 Feb 2025 23:14:32 +0100 Subject: [PATCH 08/27] Add SentryConfiguration docs --- doc_classes/SentryConfiguration.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc_classes/SentryConfiguration.xml b/doc_classes/SentryConfiguration.xml index bcd3f6dc..4063eec4 100644 --- a/doc_classes/SentryConfiguration.xml +++ b/doc_classes/SentryConfiguration.xml @@ -1,8 +1,12 @@ + Base class for user configuration script in Sentry SDK. + Allows configuring Sentry SDK from GDScript. The [method _configure] method is called just before Sentry SDK initializes. + To define a configuration script, create a new script that extends the [SentryConfiguration] class. Then, assign your configuration script in the Project Settings under the [b]Sentry[/b] category. + [b]Important[/b]: If a user configuration script is assigned, SDK initialization will be delayed until [b]ScriptServer[/b] becomes available during game startup. @@ -11,6 +15,7 @@ + Called just before the Sentry SDK initializes. You can override SDK [param options] here and register [member SentryOptions.before_send] and [member SentryOptions.on_crash] callbacks if needed. From f5e955a0dd45a918c4db81276b966de47f1f2aa3 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 12 Feb 2025 00:32:46 +0100 Subject: [PATCH 09/27] Unfinished SentryOptions docs --- doc_classes/SentryOptions.xml | 34 ++++++++++++++++++++++++++++++++++ doc_classes/SentrySDK.xml | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/doc_classes/SentryOptions.xml b/doc_classes/SentryOptions.xml index 9c12cbe8..ea4f24af 100644 --- a/doc_classes/SentryOptions.xml +++ b/doc_classes/SentryOptions.xml @@ -1,59 +1,93 @@ + Contains Sentry SDK options. + Defines options for the Sentry SDK. These options can be modified in the Project Settings under the [b]Sentry[/b] category or through a user configuration script. See [SentryConfiguration] for details on creating such a script. + If [code]true[/code], the SDK will attach the log file to the event. + If assigned, this callback will be called before the event is sent to Sentry. You can set it in a [SentryConfiguration] script. + The callback must return either the same event object, with or without modifications, or [code]null[/code]. If [code]null[/code] is returned, the event will be discarded. + TODO: add example code + If [code]true[/code], the SDK prints debug messages to standard output. These messages do not appear in the Godot console but can be seen when launching Godot from a terminal. + If [code]true[/code], the SDK will not initialize in the Godot editor. + The application's distribution. + TODO: explain it + Sentry DSN. + TODO: explain it + If [code]false[/code], the SDK will not initialize. This is useful for temporarily disabling the SDK in Project Settings, or in a [SentryConfiguration] script. + Environment for the event. Environment is automatically detected by the SDK. But you can also assign it in a [SentryConfiguration] script. + TODO: define environment + Specifies which types of errors are captured as breadcrumbs. + If [code]true[/code], the SDK will capture logged errors as events and/or breadcrumbs. Crashes are always captured. + Specifies which types of errors are captured as events. + If [code]true[/code], the SDK will include the surrounding source code of logged errors, if available. + Defines reporting limits for the error logger. These limits are used to prevent the SDK from sending too many non-critical error events. See [SentryLoggerLimits]. + Maximum number of breadcrumbs to send with an event. + If assigned, this callback will be called before the crash event is sent to Sentry. You can set it in a [SentryConfiguration] script. + The callback must return either the same event object, with or without modifications, or [code]null[/code]. If [code]null[/code] is returned, the event will be discarded. + TODO: add example code + Release version of the application. This value must be unique across all projects in your organization. Suggested format is [code]my-game@1.0.0[/code]. + You can use the [code]{app_name}[/code] and [code]{app_version}[/code] placeholders to insert the application name and version from the Project Settings. + Sample rate for the SDK. + TODO: explain it + If [code]true[/code], the SDK will include PII (Personally Identifiable Information) with the events. + No logger errors will be captured. + Native errors will be captured. These are typically C++ errors, which may also originate from a script. + Warnings will be captured. + Script errors will be captured. + Shader errors will be captured. diff --git a/doc_classes/SentrySDK.xml b/doc_classes/SentrySDK.xml index fea9f4ef..3379d5bb 100644 --- a/doc_classes/SentrySDK.xml +++ b/doc_classes/SentrySDK.xml @@ -8,7 +8,7 @@ Sentry SDK hooks into Godot's logging and automatically reports errors. An [b]event[/b] is one instance of sending data to Sentry. Generally, this data is an error or exception. While capturing an event, you can also record the [b]breadcrumbs[/b] that lead up to that event. Breadcrumbs are different from events: they will not create an event in Sentry, but will be buffered until the next event is sent. Breadcrumbs can be captured with [method SentrySDK.add_breadcrumb] method. Learn more about breadcrumbs in our [url=https://docs.sentry.io/platforms/godot/enriching-events/breadcrumbs/]Godot SDK documentation[/url]. Another common operation is to capture a bare message. A [b]message[/b] is textual information that should be sent to Sentry. Typically, our SDKs don't automatically capture messages, but you can capture them manually. Messages show up as issues on your issue stream, with the message as the issue name. To simplify creating events, there are shorthand functions that construct and capture prepopulated event objects. The most important one is [method SentrySDK.capture_message]. - For more information, see [url=https://docs.sentry.io/platforms/godot/]Godot SDK documentation[/url]. + For more information, consult the [url=https://docs.sentry.io/platforms/godot/]Godot SDK documentation[/url]. From 56a9f90f6227a7bb1d3790c99e96dc32e32d036a Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 12 Feb 2025 00:55:01 +0100 Subject: [PATCH 10/27] Add SentryLoggerLimits doc --- doc_classes/SentryLoggerLimits.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc_classes/SentryLoggerLimits.xml b/doc_classes/SentryLoggerLimits.xml index 61d665a8..bc650ffa 100644 --- a/doc_classes/SentryLoggerLimits.xml +++ b/doc_classes/SentryLoggerLimits.xml @@ -1,6 +1,7 @@ + Defines reporting limits for the error logger. @@ -8,12 +9,17 @@ + Specifies the maximum number of error events to send per processed frame. If exceeded, no further errors will be captured until the next frame. + This serves as a safety measure to prevent the SDK from overloading a single frame. + Specifies the minimum time interval in milliseconds between two identical errors. If exceeded, no further errors from the same line of code will be captured until the next interval. + Specifies the maximum number of events allowed within a sliding time window of [member throttle_window_ms] milliseconds. If exceeded, errors will be captured as breadcrumbs only until capacity is freed. + Specifies the time window in milliseconds for [member throttle_events]. From 0fb280a8e09570c5c581fc467f0a0b5831492ac7 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 12 Feb 2025 13:27:56 +0100 Subject: [PATCH 11/27] Description for logger limits --- doc_classes/SentryLoggerLimits.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/doc_classes/SentryLoggerLimits.xml b/doc_classes/SentryLoggerLimits.xml index bc650ffa..0db574e7 100644 --- a/doc_classes/SentryLoggerLimits.xml +++ b/doc_classes/SentryLoggerLimits.xml @@ -4,6 +4,7 @@ Defines reporting limits for the error logger. + These limits are used to prevent the SDK from sending too many non-critical error events. From 55db001215cfde515219a8a3e2d33bc73d3539ad Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 12 Feb 2025 13:42:32 +0100 Subject: [PATCH 12/27] Add script to update XML doc classes --- scripts/update-doc-classes.ps1 | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 scripts/update-doc-classes.ps1 diff --git a/scripts/update-doc-classes.ps1 b/scripts/update-doc-classes.ps1 new file mode 100755 index 00000000..ff24b52f --- /dev/null +++ b/scripts/update-doc-classes.ps1 @@ -0,0 +1,25 @@ +#!/usr/bin/env pwsh + +# Updates the built-in class reference documentation by generating XML files for +# new classes and updating existing ones. This process removes and adds members +# as needed, but does not handle renaming automatically. + +$godot = $env:GODOT + +if (-not $godot) { + Write-Host "GODOT environment variable is not set. Defaulting to `"godot`"." + $godot = "godot" +} + +if (-not (Get-Command $env:GODOT -ErrorAction SilentlyContinue)) { + Write-Error "Godot executable not found. Please set the GODOT environment variable." -CategoryActivity "ERROR" + exit 1 +} + +$startDir = Get-Location +$scriptDir = Split-Path -Parent (Resolve-Path $MyInvocation.MyCommand.Path) +Set-Location "$scriptDir/../project" + +& $godot --doctool ../ --gdextension-docs + +Set-Location $startDir From 40c3ab3a6ac237d7d347274b3cb868ecfd661cbc Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 12 Feb 2025 14:23:49 +0100 Subject: [PATCH 13/27] Add before_send and on_crash examples --- doc_classes/SentryOptions.xml | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/doc_classes/SentryOptions.xml b/doc_classes/SentryOptions.xml index ea4f24af..158be825 100644 --- a/doc_classes/SentryOptions.xml +++ b/doc_classes/SentryOptions.xml @@ -14,8 +14,17 @@ If assigned, this callback will be called before the event is sent to Sentry. You can set it in a [SentryConfiguration] script. - The callback must return either the same event object, with or without modifications, or [code]null[/code]. If [code]null[/code] is returned, the event will be discarded. - TODO: add example code + The callback must accept [SentryEvent] as a parameter and return either the same event object, with or without modifications, or [code]null[/code]. If [code]null[/code] is returned, the event will be discarded. + [codeblock] + func _before_send(event: SentryEvent) -> SentryEvent: + if event.message.contains("Bruno"): + # Remove sensitive information from the event. + event.message = event.message.replace("Bruno", "REDACTED") + elif event.environment == "editor_dev_run": + # Discard event if running from the editor. + return null + return event + [/codeblock] If [code]true[/code], the SDK prints debug messages to standard output. These messages do not appear in the Godot console but can be seen when launching Godot from a terminal. @@ -58,9 +67,17 @@ If assigned, this callback will be called before the crash event is sent to Sentry. You can set it in a [SentryConfiguration] script. - The callback must return either the same event object, with or without modifications, or [code]null[/code]. If [code]null[/code] is returned, the event will be discarded. - TODO: add example code - + The callback must accept [SentryEvent] as a parameter and return either the same event object, with or without modifications, or [code]null[/code]. If [code]null[/code] is returned, the event will be discarded. + [codeblock] + func _on_crash(event: SentryEvent) -> SentryEvent: + if event.message.contains("Bruno"): + # Remove sensitive information from the event. + event.message = event.message.replace("Bruno", "REDACTED") + elif event.environment == "editor_dev_run": + # Discard event if running from the editor. + return null + return event + [/codeblock] Release version of the application. This value must be unique across all projects in your organization. Suggested format is [code]my-game@1.0.0[/code]. You can use the [code]{app_name}[/code] and [code]{app_version}[/code] placeholders to insert the application name and version from the Project Settings. From 02f740a830b4fadf9e1b4ee9437f6d1c4b91f6b1 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 12 Feb 2025 14:45:57 +0100 Subject: [PATCH 14/27] Elaborate on DSN and dist in SentryOptions doc --- doc_classes/SentryOptions.xml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc_classes/SentryOptions.xml b/doc_classes/SentryOptions.xml index 158be825..e57a187c 100644 --- a/doc_classes/SentryOptions.xml +++ b/doc_classes/SentryOptions.xml @@ -5,6 +5,7 @@ Defines options for the Sentry SDK. These options can be modified in the Project Settings under the [b]Sentry[/b] category or through a user configuration script. See [SentryConfiguration] for details on creating such a script. + For more information, consult [url=https://docs.sentry.io/platforms/godot/configuration/options/]Godto SDK Options[/url] in the official documentation. @@ -33,12 +34,10 @@ If [code]true[/code], the SDK will not initialize in the Godot editor. - The application's distribution. - TODO: explain it + The application's distribution. Distributions are used to disambiguate build or deployment variants of the same release of an application. - Sentry DSN. - TODO: explain it + Data Source Name (DSN): Specifies where the SDK should send the events. If this value is not provided, the SDK will try to read it from the [code]SENTRY_DSN[/code] environment variable. If that variable also does not exist, the SDK will just not send any events. If [code]false[/code], the SDK will not initialize. This is useful for temporarily disabling the SDK in Project Settings, or in a [SentryConfiguration] script. From e29383ec39c7eb10e08d24100a3bedc964effbf9 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 12 Feb 2025 15:29:24 +0100 Subject: [PATCH 15/27] Corrections and additions --- doc_classes/SentryOptions.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc_classes/SentryOptions.xml b/doc_classes/SentryOptions.xml index e57a187c..6cb4cfa5 100644 --- a/doc_classes/SentryOptions.xml +++ b/doc_classes/SentryOptions.xml @@ -5,13 +5,13 @@ Defines options for the Sentry SDK. These options can be modified in the Project Settings under the [b]Sentry[/b] category or through a user configuration script. See [SentryConfiguration] for details on creating such a script. - For more information, consult [url=https://docs.sentry.io/platforms/godot/configuration/options/]Godto SDK Options[/url] in the official documentation. + To learn more, visit [url=https://docs.sentry.io/platforms/godot/configuration/options/]Options in the Sentry SDK documentation[/url]. - If [code]true[/code], the SDK will attach the log file to the event. + If [code]true[/code], the SDK will attach the Godot log file to the event. If assigned, this callback will be called before the event is sent to Sentry. You can set it in a [SentryConfiguration] script. @@ -28,7 +28,7 @@ [/codeblock] - If [code]true[/code], the SDK prints debug messages to standard output. These messages do not appear in the Godot console but can be seen when launching Godot from a terminal. + If [code]true[/code], the SDK will print useful debugging information to standard output. These messages do not appear in the Godot console but can be seen when launching Godot from a terminal. If [code]true[/code], the SDK will not initialize in the Godot editor. @@ -40,11 +40,11 @@ Data Source Name (DSN): Specifies where the SDK should send the events. If this value is not provided, the SDK will try to read it from the [code]SENTRY_DSN[/code] environment variable. If that variable also does not exist, the SDK will just not send any events. - If [code]false[/code], the SDK will not initialize. This is useful for temporarily disabling the SDK in Project Settings, or in a [SentryConfiguration] script. + If [code]false[/code], the SDK will not initialize. This is useful for temporarily disabling the SDK in the Project Settings, or in a [SentryConfiguration] script. - Environment for the event. Environment is automatically detected by the SDK. But you can also assign it in a [SentryConfiguration] script. - TODO: define environment + Environments indicate where an error occurred, such as in a release export, headless server, QA build, or another deployment. The SDK automatically detects Godot-specific environments, such as [code]headless_server[/code] and [code]export_release[/code], but you can also assign it in a [SentryConfiguration] script. + To learn more, visit [url=https://docs.sentry.io/platforms/godot/configuration/environments/]Environments in the Sentry SDK documentation[/url]. Specifies which types of errors are captured as breadcrumbs. From 8274069befd49102f1eba694bd812f2326a35c87 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 12 Feb 2025 20:19:58 +0100 Subject: [PATCH 16/27] Fix examples and add sync those with configuration script --- doc_classes/SentryOptions.xml | 19 ++++++++++--------- project/example_configuration.gd | 5 ++++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/doc_classes/SentryOptions.xml b/doc_classes/SentryOptions.xml index 6cb4cfa5..eccb4a58 100644 --- a/doc_classes/SentryOptions.xml +++ b/doc_classes/SentryOptions.xml @@ -17,13 +17,13 @@ If assigned, this callback will be called before the event is sent to Sentry. You can set it in a [SentryConfiguration] script. The callback must accept [SentryEvent] as a parameter and return either the same event object, with or without modifications, or [code]null[/code]. If [code]null[/code] is returned, the event will be discarded. [codeblock] - func _before_send(event: SentryEvent) -> SentryEvent: + func _before_send(event: SentryEvent) -> SentryEvent: + if event.environment == "editor_dev_run": + # Discard event if running from the editor. + return null if event.message.contains("Bruno"): # Remove sensitive information from the event. event.message = event.message.replace("Bruno", "REDACTED") - elif event.environment == "editor_dev_run": - # Discard event if running from the editor. - return null return event [/codeblock] @@ -68,15 +68,16 @@ If assigned, this callback will be called before the crash event is sent to Sentry. You can set it in a [SentryConfiguration] script. The callback must accept [SentryEvent] as a parameter and return either the same event object, with or without modifications, or [code]null[/code]. If [code]null[/code] is returned, the event will be discarded. [codeblock] - func _on_crash(event: SentryEvent) -> SentryEvent: + func _on_crash(event: SentryEvent) -> SentryEvent: + if event.environment == "editor_dev_run": + # Discard event if running from the editor. + return null if event.message.contains("Bruno"): # Remove sensitive information from the event. event.message = event.message.replace("Bruno", "REDACTED") - elif event.environment == "editor_dev_run": - # Discard event if running from the editor. - return null return event - [/codeblock] + [/codeblock] + Release version of the application. This value must be unique across all projects in your organization. Suggested format is [code]my-game@1.0.0[/code]. You can use the [code]{app_name}[/code] and [code]{app_version}[/code] placeholders to insert the application name and version from the Project Settings. diff --git a/project/example_configuration.gd b/project/example_configuration.gd index 27662413..1cd0c9b0 100644 --- a/project/example_configuration.gd +++ b/project/example_configuration.gd @@ -20,7 +20,10 @@ func _configure(options: SentryOptions) -> void: ## before_send callback example func _before_send(ev: SentryEvent) -> SentryEvent: print("[example_configuration.gd] Processing event: ", ev.id) - if ev.message == "junk": + if ev.message.contains("Bruno"): + print("[example_configuration.gd] Removing sensitive information from the event") + ev.message = ev.message.replace("Bruno", "REDACTED") + elif ev.message == "junk": print("[example_configuration.gd] Discarding event with message 'junk'") return null return ev From ed7b252dbd425235280f23e9ab75cb56b539f836 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 12 Feb 2025 20:43:44 +0100 Subject: [PATCH 17/27] Complete SentryOptions doc --- doc_classes/SentryOptions.xml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/doc_classes/SentryOptions.xml b/doc_classes/SentryOptions.xml index eccb4a58..83cd1f85 100644 --- a/doc_classes/SentryOptions.xml +++ b/doc_classes/SentryOptions.xml @@ -47,13 +47,13 @@ To learn more, visit [url=https://docs.sentry.io/platforms/godot/configuration/environments/]Environments in the Sentry SDK documentation[/url]. - Specifies which types of errors are captured as breadcrumbs. + Specifies the types of errors captured as breadcrumbs. Accepts a single value or a bitwise combination of [enum GodotErrorMask] masks. - If [code]true[/code], the SDK will capture logged errors as events and/or breadcrumbs. Crashes are always captured. + If [code]true[/code], the SDK will capture logged errors as events and/or breadcrumbs, as defined by [member error_logger_event_mask] and [member error_logger_breadcrumb_mask]. Crashes are always captured. - Specifies which types of errors are captured as events. + Specifies the types of errors captured as events. Accepts a single value or a bitwise combination of [enum GodotErrorMask] masks. If [code]true[/code], the SDK will include the surrounding source code of logged errors, if available. @@ -62,7 +62,7 @@ Defines reporting limits for the error logger. These limits are used to prevent the SDK from sending too many non-critical error events. See [SentryLoggerLimits]. - Maximum number of breadcrumbs to send with an event. + Maximum number of breadcrumbs to send with an event. You should be aware that Sentry has a maximum payload size and any events exceeding that payload size will be dropped. If assigned, this callback will be called before the crash event is sent to Sentry. You can set it in a [SentryConfiguration] script. @@ -83,8 +83,7 @@ You can use the [code]{app_name}[/code] and [code]{app_version}[/code] placeholders to insert the application name and version from the Project Settings. - Sample rate for the SDK. - TODO: explain it + Configures the sample rate for error events, in the range of 0.0 to 1.0. The default is 1.0, which means that 100% of error events will be sent. If set to 0.1, only 10% of error events will be sent. Events are picked randomly. If [code]true[/code], the SDK will include PII (Personally Identifiable Information) with the events. From 844ce9ea9bb44eafdf08c1fcd18f7a1534b7fc20 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 12 Feb 2025 20:59:56 +0100 Subject: [PATCH 18/27] Add a full configuration script example --- doc_classes/SentryConfiguration.xml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/doc_classes/SentryConfiguration.xml b/doc_classes/SentryConfiguration.xml index 4063eec4..028cd755 100644 --- a/doc_classes/SentryConfiguration.xml +++ b/doc_classes/SentryConfiguration.xml @@ -7,6 +7,26 @@ Allows configuring Sentry SDK from GDScript. The [method _configure] method is called just before Sentry SDK initializes. To define a configuration script, create a new script that extends the [SentryConfiguration] class. Then, assign your configuration script in the Project Settings under the [b]Sentry[/b] category. [b]Important[/b]: If a user configuration script is assigned, SDK initialization will be delayed until [b]ScriptServer[/b] becomes available during game startup. + [codeblock] + extends SentryConfiguration + + func _configure(options: SentryOptions): + if OS.is_debug_build(): + options.environment = "debug" + options.debug = true + options.release = "mygame@1.0.0" + options.before_send = _process_event + options.on_crash = _process_event + + func _process_event(event: SentryEvent) -> SentryEvent: + if event.environment == "debug": + # Discard event if running in a debug build. + return null + if event.message.contains("Bruno"): + # Remove sensitive information from the event. + event.message = event.message.replace("Bruno", "REDACTED") + return event + [/codeblock] From 79235b22732b263189a4932d70132adc87f48bce Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 12 Feb 2025 21:15:34 +0100 Subject: [PATCH 19/27] Second pass --- doc_classes/SentryEvent.xml | 2 +- doc_classes/SentrySDK.xml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc_classes/SentryEvent.xml b/doc_classes/SentryEvent.xml index aa3ae799..67e3bed1 100644 --- a/doc_classes/SentryEvent.xml +++ b/doc_classes/SentryEvent.xml @@ -4,7 +4,7 @@ Events are the core data sent by SDKs to the Sentry server. An event consists of simple data properties that capture key details about an occurrence. Typically, an event represents an error or exception and corresponds to a single transmission of data to the Sentry server. Events show up as issues on your issue stream, with the [member message] as the issue name. - [SentryEvent] can be created with the [method SentrySDK.create_event] method. + [SentryEvent] can be created with the [method SentrySDK.create_event] method, and then captured with [method SentrySDK.capture_event]. diff --git a/doc_classes/SentrySDK.xml b/doc_classes/SentrySDK.xml index 3379d5bb..051d2e8c 100644 --- a/doc_classes/SentrySDK.xml +++ b/doc_classes/SentrySDK.xml @@ -6,9 +6,9 @@ Provides a set of functions to log errors and events to Sentry and enrich them with tags, breadcrumbs and arbitrary context. Sentry SDK hooks into Godot's logging and automatically reports errors. An [b]event[/b] is one instance of sending data to Sentry. Generally, this data is an error or exception. - While capturing an event, you can also record the [b]breadcrumbs[/b] that lead up to that event. Breadcrumbs are different from events: they will not create an event in Sentry, but will be buffered until the next event is sent. Breadcrumbs can be captured with [method SentrySDK.add_breadcrumb] method. Learn more about breadcrumbs in our [url=https://docs.sentry.io/platforms/godot/enriching-events/breadcrumbs/]Godot SDK documentation[/url]. + While capturing an event, you can also record the [b]breadcrumbs[/b] that lead up to that event. Breadcrumbs are different from events: they will not create an event in Sentry, but will be buffered until the next event is sent. Breadcrumbs can be captured with [method SentrySDK.add_breadcrumb] method. Learn more about [url=https://docs.sentry.io/platforms/godot/enriching-events/breadcrumbs/]Breadcrumbs in the Sentry SDK documentation[/url]. Another common operation is to capture a bare message. A [b]message[/b] is textual information that should be sent to Sentry. Typically, our SDKs don't automatically capture messages, but you can capture them manually. Messages show up as issues on your issue stream, with the message as the issue name. To simplify creating events, there are shorthand functions that construct and capture prepopulated event objects. The most important one is [method SentrySDK.capture_message]. - For more information, consult the [url=https://docs.sentry.io/platforms/godot/]Godot SDK documentation[/url]. + To learn more, visit the [url=https://docs.sentry.io/platforms/godot/]Sentry SDK documentation[/url]. @@ -21,7 +21,7 @@ - Adds a breadcrumb to the next event. Sentry uses breadcrumbs to create a trail of events that happened prior to an issue. + Adds a breadcrumb to the next event. Sentry uses breadcrumbs to create a trail of events that happened prior to an issue. To learn more, visit [url=https://docs.sentry.io/platforms/godot/enriching-events/breadcrumbs/]Breadcrumbs in the Sentry SDK documentation[/url]. From 48eaffd3ac1f4c4e8393a3a62b1517db049e8528 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 12 Feb 2025 21:36:56 +0100 Subject: [PATCH 20/27] Second pass corrections --- doc_classes/SentryEvent.xml | 1 + doc_classes/SentrySDK.xml | 2 +- doc_classes/SentryUser.xml | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc_classes/SentryEvent.xml b/doc_classes/SentryEvent.xml index 67e3bed1..78ca32fd 100644 --- a/doc_classes/SentryEvent.xml +++ b/doc_classes/SentryEvent.xml @@ -38,6 +38,7 @@ Distributions are used to disambiguate build or deployment variants of the same release of an application. + Environments indicate where an error occurred, such as in a release export, headless server, QA build, or another deployment. See [member SentryOptions.environment]. Hexadecimal string representing a UUID version 4 value. Automatically set by the SDK. diff --git a/doc_classes/SentrySDK.xml b/doc_classes/SentrySDK.xml index 051d2e8c..ce3befe8 100644 --- a/doc_classes/SentrySDK.xml +++ b/doc_classes/SentrySDK.xml @@ -68,7 +68,7 @@ - Removes the tag with the specified [param key]. + Removes the tag with the given [param key]. diff --git a/doc_classes/SentryUser.xml b/doc_classes/SentryUser.xml index 96b7fd59..79af3289 100644 --- a/doc_classes/SentryUser.xml +++ b/doc_classes/SentryUser.xml @@ -25,7 +25,7 @@ - Returns [code]true[/code] if the user data is empty. + Returns [code]true[/code] if the user data is empty (including ID). From 1950bb5e26c5e96e0fdc66fc23ac916f1ee9f507 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 12 Feb 2025 21:51:39 +0100 Subject: [PATCH 21/27] Update CHANGELOG --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8e284b6..e505ed53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Features + +- In-editor class reference documentation ([#104](https://github.com/getsentry/sentry-godot/pull/104)) + ## 0.1.2 ### Breaking changes From d9e3b614cc785f49f0b514172fb39e6dc583ed77 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 12 Feb 2025 22:33:59 +0100 Subject: [PATCH 22/27] Move version header to src/gen/ folder --- .gitignore | 7 +++---- SConstruct | 2 +- src/sentry/contexts.cpp | 2 +- src/sentry_sdk.cpp | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 34da4d19..e15cb8a4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,9 @@ # Project-related -project/addons +project/addons/ project/export_presets.cfg -project/.vscode +project/.vscode/ -src/sdk_version.gen.h -src/gen/doc_data.gen.cpp +src/gen/ # Godot auto generated files project/.godot/ diff --git a/SConstruct b/SConstruct index 5a3d93b6..4bc1ef3f 100644 --- a/SConstruct +++ b/SConstruct @@ -46,7 +46,7 @@ version_header_content = """/* DO NOT EDIT - generated by SConstruct */ #endif // SENTRY_GODOT_SDK_VERSION_GEN_H """.format(version=VERSION, git_sha=git_sha) -with open("src/sdk_version.gen.h", "w") as f: +with open("src/gen/sdk_version.gen.h", "w") as f: f.write(version_header_content) diff --git a/src/sentry/contexts.cpp b/src/sentry/contexts.cpp index e9c444af..9a0e29b7 100644 --- a/src/sentry/contexts.cpp +++ b/src/sentry/contexts.cpp @@ -1,6 +1,6 @@ #include "contexts.h" -#include "sdk_version.gen.h" +#include "gen/sdk_version.gen.h" #include "sentry/environment.h" #include "sentry/uuid.h" #include "sentry_options.h" diff --git a/src/sentry_sdk.cpp b/src/sentry_sdk.cpp index 36bb21b9..22eff549 100644 --- a/src/sentry_sdk.cpp +++ b/src/sentry_sdk.cpp @@ -1,6 +1,6 @@ #include "sentry_sdk.h" -#include "sdk_version.gen.h" +#include "gen/sdk_version.gen.h" #include "sentry/contexts.h" #include "sentry/disabled_sdk.h" #include "sentry/util.h" @@ -211,7 +211,7 @@ SentrySDK::SentrySDK() { _fix_unix_executable_permissions("res://addons/sentrysdk/bin/linux/crashpad_handler"); } - bool should_enable = SentryOptions::get_singleton()->is_enabled(); + bool should_enable = SentryOptions::get_singleton()->is_enabled(); if (!should_enable) { sentry::util::print_debug("Sentry SDK is disabled in the project settings."); From 4e28c6b151c71eff8fc801bb99377087ad9736c3 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 12 Feb 2025 22:37:01 +0100 Subject: [PATCH 23/27] Fix build: create src/gen/ dir --- SConstruct | 1 + 1 file changed, 1 insertion(+) diff --git a/SConstruct b/SConstruct index 4bc1ef3f..2c862242 100644 --- a/SConstruct +++ b/SConstruct @@ -46,6 +46,7 @@ version_header_content = """/* DO NOT EDIT - generated by SConstruct */ #endif // SENTRY_GODOT_SDK_VERSION_GEN_H """.format(version=VERSION, git_sha=git_sha) +os.mkdir("src/gen/") with open("src/gen/sdk_version.gen.h", "w") as f: f.write(version_header_content) From 19e3072a7d7bbabfef070d49c026f8685521c6b2 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 12 Feb 2025 22:44:21 +0100 Subject: [PATCH 24/27] Fix create dir --- SConstruct | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 2c862242..4bfe9c5c 100644 --- a/SConstruct +++ b/SConstruct @@ -46,7 +46,8 @@ version_header_content = """/* DO NOT EDIT - generated by SConstruct */ #endif // SENTRY_GODOT_SDK_VERSION_GEN_H """.format(version=VERSION, git_sha=git_sha) -os.mkdir("src/gen/") +if not os.path.exists("src/gen/"): + os.mkdir("src/gen/") with open("src/gen/sdk_version.gen.h", "w") as f: f.write(version_header_content) From b2b6b4c6f1c2ee45744bc7c0f8aa2776747a6ef9 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 12 Feb 2025 22:47:20 +0100 Subject: [PATCH 25/27] Fix script --- scripts/update-doc-classes.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update-doc-classes.ps1 b/scripts/update-doc-classes.ps1 index ff24b52f..3d7cb9f8 100755 --- a/scripts/update-doc-classes.ps1 +++ b/scripts/update-doc-classes.ps1 @@ -11,7 +11,7 @@ if (-not $godot) { $godot = "godot" } -if (-not (Get-Command $env:GODOT -ErrorAction SilentlyContinue)) { +if (-not (Get-Command $godot -ErrorAction SilentlyContinue)) { Write-Error "Godot executable not found. Please set the GODOT environment variable." -CategoryActivity "ERROR" exit 1 } From c8b5d42395c8d02a46ff027b7a83deaa5f8ee5d5 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Fri, 21 Feb 2025 17:42:12 +0100 Subject: [PATCH 26/27] Sync with official docs --- doc_classes/SentryLoggerLimits.xml | 4 ++-- doc_classes/SentryOptions.xml | 12 ++++++------ doc_classes/SentrySDK.xml | 2 ++ doc_classes/SentryUser.xml | 1 + 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/doc_classes/SentryLoggerLimits.xml b/doc_classes/SentryLoggerLimits.xml index 0db574e7..d8f86f38 100644 --- a/doc_classes/SentryLoggerLimits.xml +++ b/doc_classes/SentryLoggerLimits.xml @@ -1,10 +1,10 @@ - Defines reporting limits for the error logger. + Specifies throttling limits for the error logger. - These limits are used to prevent the SDK from sending too many non-critical error events. + These limits govern the behavior of throttling and are used to prevent the SDK from sending too many non-critical and repeating error events. diff --git a/doc_classes/SentryOptions.xml b/doc_classes/SentryOptions.xml index 83cd1f85..46d60b06 100644 --- a/doc_classes/SentryOptions.xml +++ b/doc_classes/SentryOptions.xml @@ -14,8 +14,7 @@ If [code]true[/code], the SDK will attach the Godot log file to the event. - If assigned, this callback will be called before the event is sent to Sentry. You can set it in a [SentryConfiguration] script. - The callback must accept [SentryEvent] as a parameter and return either the same event object, with or without modifications, or [code]null[/code]. If [code]null[/code] is returned, the event will be discarded. + If assigned, this callback runs before a message or error event is sent to Sentry. It takes [SentryEvent] as a parameter and return either the same event object, with or without modifications, or [code]null[/code] to skip reporting the event. You can assign it in a [SentryConfiguration] script. [codeblock] func _before_send(event: SentryEvent) -> SentryEvent: if event.environment == "editor_dev_run": @@ -26,6 +25,7 @@ event.message = event.message.replace("Bruno", "REDACTED") return event [/codeblock] + To learn more, visit [url=https://docs.sentry.io/platforms/godot/configuration/filtering/]Filtering in the Sentry SDK documentation[/url]. If [code]true[/code], the SDK will print useful debugging information to standard output. These messages do not appear in the Godot console but can be seen when launching Godot from a terminal. @@ -56,17 +56,16 @@ Specifies the types of errors captured as events. Accepts a single value or a bitwise combination of [enum GodotErrorMask] masks. - If [code]true[/code], the SDK will include the surrounding source code of logged errors, if available. + If [code]true[/code], the SDK will include the surrounding source code of logged errors, if available in the exported project. - Defines reporting limits for the error logger. These limits are used to prevent the SDK from sending too many non-critical error events. See [SentryLoggerLimits]. + Defines throttling limits for the error logger. These limits are used to prevent the SDK from sending too many non-critical and repeating error events. See [SentryLoggerLimits]. Maximum number of breadcrumbs to send with an event. You should be aware that Sentry has a maximum payload size and any events exceeding that payload size will be dropped. - If assigned, this callback will be called before the crash event is sent to Sentry. You can set it in a [SentryConfiguration] script. - The callback must accept [SentryEvent] as a parameter and return either the same event object, with or without modifications, or [code]null[/code]. If [code]null[/code] is returned, the event will be discarded. + If assigned, this callback runs before a crash event is sent to Sentry. In contrast to [member before_send], it is only called when a crash occurred. It takes [SentryEvent] as a parameter and return either the same event object, with or without modifications, or [code]null[/code] to skip reporting the event. You can assign it in a [SentryConfiguration] script. [codeblock] func _on_crash(event: SentryEvent) -> SentryEvent: if event.environment == "editor_dev_run": @@ -77,6 +76,7 @@ event.message = event.message.replace("Bruno", "REDACTED") return event [/codeblock] + To learn more, visit [url=https://docs.sentry.io/platforms/godot/configuration/filtering/]Filtering in the Sentry SDK documentation[/url]. Release version of the application. This value must be unique across all projects in your organization. Suggested format is [code]my-game@1.0.0[/code]. diff --git a/doc_classes/SentrySDK.xml b/doc_classes/SentrySDK.xml index ce3befe8..60f8caa9 100644 --- a/doc_classes/SentrySDK.xml +++ b/doc_classes/SentrySDK.xml @@ -83,6 +83,7 @@ Adds a custom context with the specified [param key] and [param value]. The [param value] should be a dictionary with string keys and can have multiple levels of nesting. + To learn more, visit [url=https://docs.sentry.io/platforms/godot/enriching-events/context/]Context in the Sentry SDK documentation[/url]. @@ -91,6 +92,7 @@ Assigns a tag with the specified [param key] and [param value]. + To learn more, visit [url=https://docs.sentry.io/platforms/godot/enriching-events/tags/]Tags in the Sentry SDK documentation[/url]. diff --git a/doc_classes/SentryUser.xml b/doc_classes/SentryUser.xml index 79af3289..b6d11e25 100644 --- a/doc_classes/SentryUser.xml +++ b/doc_classes/SentryUser.xml @@ -6,6 +6,7 @@ Users consist of a few critical pieces of information that construct a unique identity in Sentry. Each of the properties is optional, but one [b]must[/b] be present for the Sentry SDK to capture the user. If no user data is set using [method SentrySDK.set_user], the SDK falls back to a generated ID, which the SDK randomly generates once for each installation. Additionally, if [member SentryOptions.send_default_pii] is [code]true[/code], Sentry will infer the IP address from the connection between your game and Sentry's server. + To learn more, visit [url=https://docs.sentry.io/platforms/godot/enriching-events/users/]Users in the Sentry SDK documentation[/url]. From f57fbe6a3c09eabcf9a3ae9413bfcbdb0865fb1a Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Fri, 21 Feb 2025 21:17:24 +0100 Subject: [PATCH 27/27] Simpler links --- doc_classes/SentryLoggerLimits.xml | 2 +- doc_classes/SentryOptions.xml | 8 ++++---- doc_classes/SentrySDK.xml | 9 +++++---- doc_classes/SentryUser.xml | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/doc_classes/SentryLoggerLimits.xml b/doc_classes/SentryLoggerLimits.xml index d8f86f38..eb10f0d5 100644 --- a/doc_classes/SentryLoggerLimits.xml +++ b/doc_classes/SentryLoggerLimits.xml @@ -4,7 +4,7 @@ Specifies throttling limits for the error logger. - These limits govern the behavior of throttling and are used to prevent the SDK from sending too many non-critical and repeating error events. + These limits govern the behavior of throttling and are used to prevent the SDK from sending too many non-critical and repeating error events. See also [SentryOptions]. diff --git a/doc_classes/SentryOptions.xml b/doc_classes/SentryOptions.xml index 46d60b06..659434cc 100644 --- a/doc_classes/SentryOptions.xml +++ b/doc_classes/SentryOptions.xml @@ -5,7 +5,7 @@ Defines options for the Sentry SDK. These options can be modified in the Project Settings under the [b]Sentry[/b] category or through a user configuration script. See [SentryConfiguration] for details on creating such a script. - To learn more, visit [url=https://docs.sentry.io/platforms/godot/configuration/options/]Options in the Sentry SDK documentation[/url]. + To learn more, visit [url=https://docs.sentry.io/platforms/godot/configuration/options/]Options documentation[/url]. @@ -25,7 +25,7 @@ event.message = event.message.replace("Bruno", "REDACTED") return event [/codeblock] - To learn more, visit [url=https://docs.sentry.io/platforms/godot/configuration/filtering/]Filtering in the Sentry SDK documentation[/url]. + To learn more, visit [url=https://docs.sentry.io/platforms/godot/configuration/filtering/]Filtering documentation[/url]. Also, check out [url=https://docs.sentry.io/platforms/godot/data-management/sensitive-data/]Scrubbing Sensitive Data[/url]. If [code]true[/code], the SDK will print useful debugging information to standard output. These messages do not appear in the Godot console but can be seen when launching Godot from a terminal. @@ -44,7 +44,7 @@ Environments indicate where an error occurred, such as in a release export, headless server, QA build, or another deployment. The SDK automatically detects Godot-specific environments, such as [code]headless_server[/code] and [code]export_release[/code], but you can also assign it in a [SentryConfiguration] script. - To learn more, visit [url=https://docs.sentry.io/platforms/godot/configuration/environments/]Environments in the Sentry SDK documentation[/url]. + To learn more, visit [url=https://docs.sentry.io/platforms/godot/configuration/environments/]Environments documentation[/url]. Specifies the types of errors captured as breadcrumbs. Accepts a single value or a bitwise combination of [enum GodotErrorMask] masks. @@ -76,7 +76,7 @@ event.message = event.message.replace("Bruno", "REDACTED") return event [/codeblock] - To learn more, visit [url=https://docs.sentry.io/platforms/godot/configuration/filtering/]Filtering in the Sentry SDK documentation[/url]. + To learn more, visit [url=https://docs.sentry.io/platforms/godot/configuration/filtering/]Filtering documentation[/url]. Release version of the application. This value must be unique across all projects in your organization. Suggested format is [code]my-game@1.0.0[/code]. diff --git a/doc_classes/SentrySDK.xml b/doc_classes/SentrySDK.xml index 60f8caa9..5360596c 100644 --- a/doc_classes/SentrySDK.xml +++ b/doc_classes/SentrySDK.xml @@ -8,7 +8,7 @@ Sentry SDK hooks into Godot's logging and automatically reports errors. An [b]event[/b] is one instance of sending data to Sentry. Generally, this data is an error or exception. While capturing an event, you can also record the [b]breadcrumbs[/b] that lead up to that event. Breadcrumbs are different from events: they will not create an event in Sentry, but will be buffered until the next event is sent. Breadcrumbs can be captured with [method SentrySDK.add_breadcrumb] method. Learn more about [url=https://docs.sentry.io/platforms/godot/enriching-events/breadcrumbs/]Breadcrumbs in the Sentry SDK documentation[/url]. Another common operation is to capture a bare message. A [b]message[/b] is textual information that should be sent to Sentry. Typically, our SDKs don't automatically capture messages, but you can capture them manually. Messages show up as issues on your issue stream, with the message as the issue name. To simplify creating events, there are shorthand functions that construct and capture prepopulated event objects. The most important one is [method SentrySDK.capture_message]. - To learn more, visit the [url=https://docs.sentry.io/platforms/godot/]Sentry SDK documentation[/url]. + To learn more, visit [url=https://docs.sentry.io/platforms/godot/]Sentry SDK documentation[/url]. @@ -21,7 +21,8 @@ - Adds a breadcrumb to the next event. Sentry uses breadcrumbs to create a trail of events that happened prior to an issue. To learn more, visit [url=https://docs.sentry.io/platforms/godot/enriching-events/breadcrumbs/]Breadcrumbs in the Sentry SDK documentation[/url]. + Adds a breadcrumb to the next event. Sentry uses breadcrumbs to create a trail of events that happened prior to an issue. + To learn more, visit [url=https://docs.sentry.io/platforms/godot/enriching-events/breadcrumbs/]Breadcrumbs documentation[/url]. @@ -83,7 +84,7 @@ Adds a custom context with the specified [param key] and [param value]. The [param value] should be a dictionary with string keys and can have multiple levels of nesting. - To learn more, visit [url=https://docs.sentry.io/platforms/godot/enriching-events/context/]Context in the Sentry SDK documentation[/url]. + To learn more, visit [url=https://docs.sentry.io/platforms/godot/enriching-events/context/]Context documentation[/url]. @@ -92,7 +93,7 @@ Assigns a tag with the specified [param key] and [param value]. - To learn more, visit [url=https://docs.sentry.io/platforms/godot/enriching-events/tags/]Tags in the Sentry SDK documentation[/url]. + To learn more, visit [url=https://docs.sentry.io/platforms/godot/enriching-events/tags/]Tags documentation[/url]. diff --git a/doc_classes/SentryUser.xml b/doc_classes/SentryUser.xml index b6d11e25..73836ae9 100644 --- a/doc_classes/SentryUser.xml +++ b/doc_classes/SentryUser.xml @@ -6,7 +6,7 @@ Users consist of a few critical pieces of information that construct a unique identity in Sentry. Each of the properties is optional, but one [b]must[/b] be present for the Sentry SDK to capture the user. If no user data is set using [method SentrySDK.set_user], the SDK falls back to a generated ID, which the SDK randomly generates once for each installation. Additionally, if [member SentryOptions.send_default_pii] is [code]true[/code], Sentry will infer the IP address from the connection between your game and Sentry's server. - To learn more, visit [url=https://docs.sentry.io/platforms/godot/enriching-events/users/]Users in the Sentry SDK documentation[/url]. + To learn more, visit [url=https://docs.sentry.io/platforms/godot/enriching-events/users/]Users documentation[/url].