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
8 changes: 4 additions & 4 deletions docs/platforms/godot/configuration/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ This option currently only affects Web exports; other platforms always use the s

Controls which downstream services can receive tracing headers.

When you pass a URL to `SentrySpan.get_trace_headers(url)`, the SDK returns headers only if that URL matches one of the targets.
`SentryHTTPRequest` adds tracing headers only when its initial request URL matches one of the targets. When you propagate trace context yourself, pass the destination URL to `SentrySpan.get_trace_headers(url)` to apply the same targets.

- A `String` matches when it appears anywhere in the URL. The special string `".*"` matches every URL and is the only entry by default.
- A `RegEx` searches the complete URL. Use an anchored expression to match a specific origin.
- An empty array blocks headers for all URLs passed to `get_trace_headers(url)`.
- An empty array blocks headers for the initial URL of every `SentryHTTPRequest` and every URL passed to `get_trace_headers(url)`.

Omitting the URL when calling `get_trace_headers()` bypasses this option, including an empty target list. This option doesn't attach headers automatically.
Omitting the URL when calling `get_trace_headers()` bypasses this option, including an empty target list. Other HTTP clients may require <PlatformLink to="/tracing/distributed-tracing/custom-trace-propagation/">custom trace propagation</PlatformLink>.

In **Project Settings > Sentry > Options**, **Trace Propagation Targets** accepts strings only. Add `RegEx` entries in your initialization callback. See <PlatformLink to="/tracing/distributed-tracing/limiting-trace-propagation/">Limiting Trace Propagation</PlatformLink> for an example.

Expand All @@ -187,7 +187,7 @@ In **Project Settings > Sentry > Options**, **Trace Propagation Targets** accept

Controls whether outgoing tracing headers include the W3C `traceparent` header alongside `sentry-trace` and `baggage`.

Set this option to `true` when your backend uses OpenTelemetry or another W3C Trace Context-compatible library to continue traces. `SentrySpan.get_trace_headers()` then includes `traceparent` in the returned headers.
Set this option to `true` when your backend uses OpenTelemetry or another W3C Trace Context-compatible library to continue traces. `SentryHTTPRequest` then adds `traceparent` to matching requests, and `SentrySpan.get_trace_headers()` includes it in the returned headers.

[`trace_propagation_targets`](#trace_propagation_targets) controls where this header is allowed when you pass a URL. For Web exports, also <PlatformLink to="/tracing/distributed-tracing/dealing-with-cors-issues/">allow `traceparent` in your backend's CORS configuration</PlatformLink>.

Expand Down
6 changes: 6 additions & 0 deletions docs/platforms/godot/data-management/data-collected.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ SentrySdk.ConfigureScope(scope =>

The Sentry SDK collects information about the device, such as the name, version and build of your operating system or Linux distribution. This information is sent to Sentry by default.

## HTTP Request Information

When you use `SentryHTTPRequest`, the SDK records the request method, host, redacted URL, request and response body sizes, and HTTP response status code. For transport failures, it also records an error type when available.

Recorded URLs omit credentials, query strings, and fragments. The SDK doesn't record request or response body contents or custom header values. See <PlatformLink to="/tracing/instrumentation/#trace-http-requests-automatically">Trace HTTP Requests Automatically</PlatformLink> for setup.

## Screenshots

The <PlatformLink to="/enriching-events/screenshots">screenshot feature</PlatformLink> is disabled by default. If you choose to enable this feature in options, any screenshots captured may contain sensitive data visible in the application at the time of the error.
Expand Down
4 changes: 4 additions & 0 deletions docs/platforms/godot/enriching-events/breadcrumbs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ Manually record a breadcrumb:
<PlatformContent includePath="enriching-events/breadcrumbs/breadcrumbs-example" />

The available breadcrumb keys are `type`, `category`, `message`, `level`, `timestamp` (which many SDKs will set automatically for you), and `data`, which is the place to put any additional information you'd like the breadcrumb to include. Using keys other than these six won't cause an error, but will result in the data being dropped when the event is processed by Sentry.

## Automatic Breadcrumbs

<PlatformContent includePath="enriching-events/breadcrumbs/automatic-breadcrumbs" />
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ sidebar_order: 10

To follow an operation from your game into a backend service, attach the span's trace headers to the outgoing request. First, <PlatformLink to="/tracing/distributed-tracing/">set up distributed tracing</PlatformLink> in both your game and backend.

<Alert title="Automatic Propagation With SentryHTTPRequest">

`SentryHTTPRequest` <PlatformLink to="/tracing/instrumentation/#trace-http-requests-automatically">adds trace headers automatically</PlatformLink>. Use custom trace propagation with Godot's `HTTPRequest`, `HTTPClient`, `WebSocketPeer`, or another client that the SDK doesn't instrument.

</Alert>

## Add Trace Headers to Requests

`SentrySpan.get_trace_headers(url)` returns a `PackedStringArray` of `Name: Value` strings. You can pass these directly to `HTTPRequest.request()`, `HTTPClient.request()`, or `WebSocketPeer.handshake_headers`. Pass the destination URL so the SDK applies your <PlatformLink to="/tracing/distributed-tracing/limiting-trace-propagation/">trace propagation targets</PlatformLink>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ Access-Control-Allow-Headers: sentry-trace, baggage, traceparent

## Check the SDK Targets Too

If you've restricted <PlatformLink to="/tracing/distributed-tracing/limiting-trace-propagation/">trace propagation targets</PlatformLink>, make sure they include your backend URL so `get_trace_headers(url)` returns tracing headers for it.
If you've restricted <PlatformLink to="/tracing/distributed-tracing/limiting-trace-propagation/">trace propagation targets</PlatformLink>, make sure they include your backend URL. `SentryHTTPRequest` automatically adds tracing headers to matching requests. For custom instrumentation, pass the request URL to `SentrySpan.get_trace_headers(url)` and add the returned headers to the request.
4 changes: 2 additions & 2 deletions docs/platforms/godot/tracing/distributed-tracing/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Distributed tracing connects work in your game with work in your backend. For ex

## Connect Your Game and Backend

The Godot SDK provides trace headers that you attach to outgoing requests manually. It doesn't instrument HTTP requests automatically.
Use `SentryHTTPRequest` to instrument outgoing HTTP and HTTPS requests and add trace headers automatically. For Godot's `HTTPRequest`, `HTTPClient`, `WebSocketPeer`, or another client that the SDK doesn't instrument, attach the headers manually.

1. <PlatformLink to="/tracing/">Enable tracing</PlatformLink> in your game.
2. Set up the [Sentry SDK](/platforms/) for your backend and enable its distributed tracing support.
3. Follow <PlatformLink to="/tracing/distributed-tracing/custom-trace-propagation/">Custom Trace Propagation</PlatformLink> to attach headers from a span to your request.
3. Either <PlatformLink to="/tracing/instrumentation/#trace-http-requests-automatically">send the request with `SentryHTTPRequest`</PlatformLink> or follow <PlatformLink to="/tracing/distributed-tracing/custom-trace-propagation/">Custom Trace Propagation</PlatformLink> to attach headers from a span yourself.

The receiving service uses these headers to continue the same trace:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: "Learn how to restrict outgoing trace headers to trusted backend se
sidebar_order: 100
---

By default, the SDK returns tracing headers for any destination URL. To restrict propagation to specific services, configure <PlatformLink to="/configuration/options/#trace_propagation_targets">`trace_propagation_targets`</PlatformLink>:
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 <PlatformLink to="/configuration/options/#trace_propagation_targets">`trace_propagation_targets`</PlatformLink>:

```GDScript {filename:ProjectMainLoop.gd}
class_name ProjectMainLoop
Expand All @@ -20,6 +20,6 @@ func _initialize() -> void:

This matches URLs such as `https://api.example.com/scores`. See <PlatformLink to="/configuration/options/#programmatic-configuration">Programmatic Configuration</PlatformLink> for the manual initialization setup.

Pass the destination URL to `get_trace_headers(url)` to apply these targets. Unmatched URLs receive no tracing headers; an empty target list blocks all URLs. Calling `get_trace_headers()` without a URL bypasses filtering. You still need to <PlatformLink to="/tracing/distributed-tracing/custom-trace-propagation/">attach the returned headers to your request</PlatformLink>.
`SentryHTTPRequest` applies these targets to the initial request URL automatically. For <PlatformLink to="/tracing/distributed-tracing/custom-trace-propagation/">custom trace propagation</PlatformLink>, 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 <PlatformLink to="/configuration/options/#trace_propagation_targets">option reference</PlatformLink> explains string and regular expression matching and configuration through Project Settings.
67 changes: 66 additions & 1 deletion docs/platforms/godot/tracing/instrumentation/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,72 @@ Before adding spans, <PlatformLink to="/tracing/">enable tracing</PlatformLink>

</Alert>

The SDK for Godot Engine doesn't create spans automatically yet. Add manual instrumentation around operations whose timing helps you understand the player experience, such as loading a level, generating a world, or writing a save file.
The SDK automatically instruments HTTP and HTTPS requests made with `SentryHTTPRequest`. Add manual instrumentation around other operations whose timing helps you understand the player experience, such as loading a level, generating a world, or writing a save file.

## Trace HTTP Requests Automatically

Use `SentryHTTPRequest` in place of Godot's `HTTPRequest` to measure an outgoing request, propagate its trace context, and record an HTTP breadcrumb without managing the span yourself.

The node wraps an internal `HTTPRequest` and exposes the same request methods, configuration properties, and `request_completed` signal. It inherits `Node`, not `HTTPRequest`, so replace the node rather than casting or extending an existing `HTTPRequest`.

This example fetches leaderboard data and waits for the instrumented request to finish:

```GDScript {filename:leaderboard.gd}
extends Node

func fetch_scores() -> void:
var request := SentryHTTPRequest.new()
request.timeout = 10.0
add_child(request)

var error: Error = request.request("https://api.example.com/scores")
if error != OK:
request.queue_free()
push_error("Could not start the scores request: %s" % error_string(error))
return

var response: Array = await request.request_completed
request.queue_free()

var result: int = response[0]
var status_code: int = response[1]
var body: PackedByteArray = response[3]
if result != HTTPRequest.RESULT_SUCCESS or status_code != 200:
push_error("Could not fetch scores")
return

var scores: Variant = JSON.parse_string(body.get_string_from_utf8())
print(scores)
```

Each request starts an `http.client` span and uses the active span as its parent when one exists. The span ends when the request completes, is canceled, or the node leaves the scene tree.

The SDK adds trace headers according to your <PlatformLink to="/tracing/distributed-tracing/limiting-trace-propagation/">trace propagation targets</PlatformLink> without replacing headers supplied by your code. For Web exports, the destination must also <PlatformLink to="/tracing/distributed-tracing/dealing-with-cors-issues/">allow the tracing headers through CORS</PlatformLink>.

The span records the request method, host, redacted URL, request and response body sizes, and HTTP response status code. For transport failures, it also records an error type when available.

HTTP responses with status codes of `400` or higher mark the span as an error. Recorded URLs omit credentials, query strings, and fragments. The SDK doesn't record body contents or custom header values.

Each `SentryHTTPRequest` handles one request at a time. Use a separate node for each concurrent request, and call its methods from the main thread even when `use_threads` is enabled.

<Alert level="warning" title="Check Redirect Destinations">

Godot forwards custom headers, including tracing headers, when it follows redirects. `SentryHTTPRequest` checks propagation targets against only the initial URL. If a request can redirect to an untrusted destination, set `max_redirects` to `0`, validate the `Location` response header, and start a separate request.

</Alert>

### Instrument HTTP Requests in C#

For C# requests made with `HttpClient`, use the .NET SDK's `SentryHttpMessageHandler`:

```csharp
using System.Net.Http;
using Sentry;

var httpClient = new HttpClient(new SentryHttpMessageHandler());
```

The handler creates spans for outgoing requests and propagates trace headers. See [Automatic Instrumentation for .NET](/platforms/dotnet/tracing/instrumentation/automatic-instrumentation/) for details.

## Wrap a Synchronous Operation

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HTTP breadcrumbs show which backend requests led up to an issue. `SentryHTTPRequest` records one when an outgoing request completes, fails, or is canceled. See <PlatformLink to="/tracing/instrumentation/#trace-http-requests-automatically">Trace HTTP Requests Automatically</PlatformLink> for setup and the request data it records.
Loading