Limiting Trace Propagation for Godot Engine
Learn how to restrict outgoing trace headers to trusted backend services in your Godot game.
By default, SentryHTTPRequest adds tracing headers and SentrySpan.get_trace_headers(url) returns them for any destination URL. To restrict propagation to specific services, configure trace_propagation_targets:
ProjectMainLoop.gdclass_name ProjectMainLoop
extends SceneTree
func _initialize() -> void:
SentrySDK.init(func(options: SentryOptions) -> void:
options.trace_propagation_targets = [
RegEx.create_from_string("^https://api\\.example\\.com/"),
]
)
class_name ProjectMainLoop
extends SceneTree
func _initialize() -> void:
SentrySDK.init(func(options: SentryOptions) -> void:
options.trace_propagation_targets = [
RegEx.create_from_string("^https://api\\.example\\.com/"),
]
)
This matches URLs such as https://api.example.com/scores. See Programmatic Configuration for the manual initialization setup.
SentryHTTPRequest applies these targets to the initial request URL automatically. For custom trace propagation, pass the destination URL to SentrySpan.get_trace_headers(url) to apply the same filter. When a URL doesn't match, or when the target list is empty, SentryHTTPRequest doesn't add tracing headers and SentrySpan.get_trace_headers(url) returns an empty array. Calling get_trace_headers() without a URL bypasses filtering.
The option reference explains string and regular expression matching and configuration through Project Settings.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").