From 78fef3f2eaa1b111ce7287f987e7f2ab53ed0164 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Fri, 11 Sep 2026 19:22:00 +0200 Subject: [PATCH 1/2] docs(godot): Explain scope forking for active spans --- docs/platforms/godot/enriching-events/scopes/index.mdx | 10 ++++++++++ docs/platforms/godot/tracing/instrumentation/index.mdx | 2 ++ 2 files changed, 12 insertions(+) diff --git a/docs/platforms/godot/enriching-events/scopes/index.mdx b/docs/platforms/godot/enriching-events/scopes/index.mdx index 3ae87d62070ba..0c76f0a3d1cc3 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 6d9144c41678d..324bc2323ca42 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. From 5fe96e7b5eadbc494e45a637d38592724e628ffd Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Tue, 15 Sep 2026 17:06:31 +0200 Subject: [PATCH 2/2] Clarify which scope with_span forks --- docs/platforms/godot/enriching-events/scopes/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/godot/enriching-events/scopes/index.mdx b/docs/platforms/godot/enriching-events/scopes/index.mdx index 0c76f0a3d1cc3..2daf4fdd1eff4 100644 --- a/docs/platforms/godot/enriching-events/scopes/index.mdx +++ b/docs/platforms/godot/enriching-events/scopes/index.mdx @@ -109,7 +109,7 @@ By default, starting an active span with `SentrySDK.start_span()` forks the curr 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. +`SentrySDK.with_span()` always forks the current scope 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.