diff --git a/docs/platforms/godot/enriching-events/scopes/index.mdx b/docs/platforms/godot/enriching-events/scopes/index.mdx index 3ae87d62070ba4..0c76f0a3d1cc34 100644 --- a/docs/platforms/godot/enriching-events/scopes/index.mdx +++ b/docs/platforms/godot/enriching-events/scopes/index.mdx @@ -103,6 +103,16 @@ Crash reports are the exception. They carry only what was set on the global scop +## Scopes and Active Spans + +By default, starting an active span with `SentrySDK.start_span()` forks the current scope and makes the fork current on the calling thread. Data you write to the scope through `SentrySDK.get_current_scope()` enriches telemetry captured while that scope is in effect. When the span ends, the previous scope becomes current again, and those changes no longer apply. + +If you explicitly pass a `parent_span` that was started as active, the SDK forks that parent's scope instead, even when another span is currently active. The fork inherits that parent's scope data at the moment the child starts. If the parent was started as inactive, the SDK forks the current scope. + +`SentrySDK.with_span()` forks a scope the same way and restores the previous scope when its callable returns. Starting an inactive span with `active` set to `false` doesn't fork or change the current scope. + +Data you write through `SentrySDK` methods still goes to the global scope, even while a span is active. Use those methods for data that should outlive the span. + ## Scopes and Threads The current scope belongs to the thread that created it. Write to it from another thread and the SDK rejects the call with an error and drops the data. diff --git a/docs/platforms/godot/tracing/instrumentation/index.mdx b/docs/platforms/godot/tracing/instrumentation/index.mdx index 6d9144c41678dc..324bc2323ca42a 100644 --- a/docs/platforms/godot/tracing/instrumentation/index.mdx +++ b/docs/platforms/godot/tracing/instrumentation/index.mdx @@ -73,6 +73,8 @@ func load_level(level_path: String) -> void: Pass `sentry.op` when starting the span to categorize the work in Sentry. Some platforms fix the operation when the span starts, so setting this attribute later isn't supported. +By default, starting an active span forks the current scope and makes the fork current. Changes made to that scope do not outlive the span. See Scopes and Active Spans for details. + With the default static trace lifecycle, an unended root span isn't sent. End child spans before their parent; platforms can handle unfinished children differently if the parent ends first.