diff --git a/docs/platforms/godot/enriching-events/attachments/index.mdx b/docs/platforms/godot/enriching-events/attachments/index.mdx index 6b4e9aec4b688c..b496e3a8882585 100644 --- a/docs/platforms/godot/enriching-events/attachments/index.mdx +++ b/docs/platforms/godot/enriching-events/attachments/index.mdx @@ -49,6 +49,8 @@ You can add attachments that will be sent with every event using +Adding an attachment to a scope instead sends it only with what's captured while that scope is in effect. + In GDScript, you can also add attachments inside the `SentrySDK.init()` configuration callback. This is useful when you want to register attachments as part of SDK setup: ```GDScript diff --git a/docs/platforms/godot/enriching-events/scopes/index.mdx b/docs/platforms/godot/enriching-events/scopes/index.mdx index 2647cf2af926e5..8addfe1bdcf372 100644 --- a/docs/platforms/godot/enriching-events/scopes/index.mdx +++ b/docs/platforms/godot/enriching-events/scopes/index.mdx @@ -9,7 +9,7 @@ When the SDK captures an event, it merges the event data with the extra informat ## What's a Scope? -A scope holds the data that rides along with your telemetry: tags, contexts, breadcrumbs, user, severity level, fingerprint, and attributes attached to logs and metrics. `SentryScope` provides setters for these values, except breadcrumbs, which you append with `add_breadcrumb()`. Calling `clear()` empties the scope, including any data it inherited when it was forked. Data set globally is unaffected. +A scope holds the data that rides along with your telemetry: tags, contexts, breadcrumbs, attachments, user, severity level, fingerprint, and attributes attached to logs and metrics. `SentryScope` provides setters for these values, except breadcrumbs and attachments, which you append with `add_breadcrumb()` and `add_attachment()`. Calling `clear()` empties the scope, including any data it inherited when it was forked. Data set globally is unaffected. When a scope is forked, the fork inherits everything the parent holds at that moment. The two are independent from then on: writes to the fork never reach the parent, and later writes to the parent never reach the fork. diff --git a/platform-includes/enriching-events/attachment-upload/godot.mdx b/platform-includes/enriching-events/attachment-upload/godot.mdx index c437243c076011..dadb97849d8273 100644 --- a/platform-includes/enriching-events/attachment-upload/godot.mdx +++ b/platform-includes/enriching-events/attachment-upload/godot.mdx @@ -1,7 +1,15 @@ ```gdscript {tabTitle:GDScript} {mdExpandTabs} var attachment := SentryAttachment.create_with_path("user://logs/godot.log") attachment.content_type = "text/plain" + +# Global scope: attached to every event. SentrySDK.add_attachment(attachment) + +# Current scope: attached only to what's captured inside the callable. +SentrySDK.with_scope(func(scope: SentryScope) -> void: + scope.add_attachment(SentryAttachment.create_with_path("user://savegame.dat")) + SentrySDK.capture_message("Save failed") +) ``` ```csharp {tabTitle:C#}