Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/platforms/godot/enriching-events/attachments/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ You can add attachments that will be sent with every event using <PlatformIdenti

<PlatformContent includePath="enriching-events/attachment-upload" />

Adding an attachment to a <PlatformLink to="/enriching-events/scopes/">scope</PlatformLink> 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
Expand Down
2 changes: 1 addition & 1 deletion docs/platforms/godot/enriching-events/scopes/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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: <PlatformLink to="/enriching-events/tags/">tags</PlatformLink>, <PlatformLink to="/enriching-events/context/">contexts</PlatformLink>, <PlatformLink to="/enriching-events/breadcrumbs/">breadcrumbs</PlatformLink>, <PlatformLink to="/enriching-events/identify-user/">user</PlatformLink>, severity level, fingerprint, and attributes attached to <PlatformLink to="/logs/">logs</PlatformLink> and <PlatformLink to="/metrics/">metrics</PlatformLink>. `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: <PlatformLink to="/enriching-events/tags/">tags</PlatformLink>, <PlatformLink to="/enriching-events/context/">contexts</PlatformLink>, <PlatformLink to="/enriching-events/breadcrumbs/">breadcrumbs</PlatformLink>, <PlatformLink to="/enriching-events/attachments/">attachments</PlatformLink>, <PlatformLink to="/enriching-events/identify-user/">user</PlatformLink>, severity level, fingerprint, and attributes attached to <PlatformLink to="/logs/">logs</PlatformLink> and <PlatformLink to="/metrics/">metrics</PlatformLink>. `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.

Expand Down
Original file line number Diff line number Diff line change
@@ -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#}
Expand Down
Loading