---
title: "Set Up Distributed Tracing"
description: "Learn how to connect operations in your Godot game with requests to your backend services."
url: https://docs.sentry.io/platforms/godot/tracing/distributed-tracing/
---

# Set Up Distributed Tracing | Sentry for Godot Engine

Available since: `v2.2.0`

Distributed tracing connects work in your game with work in your backend. For example, a trace can show how much time a leaderboard request spends in the game, your API, and its database.

## [Connect Your Game and Backend](https://docs.sentry.io/platforms/godot/tracing/distributed-tracing.md#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.

1. [Enable tracing](https://docs.sentry.io/platforms/godot/tracing.md) in your game.
2. Set up the [Sentry SDK](https://docs.sentry.io/platforms.md) for your backend and enable its distributed tracing support.
3. Follow [Custom Trace Propagation](https://docs.sentry.io/platforms/godot/tracing/distributed-tracing/custom-trace-propagation.md) to attach headers from a span to your request.

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

* `sentry-trace` identifies the trace, the sending span, and its sampling decision.
* `baggage` carries additional trace metadata, such as the sample rate and organization ID.
* `traceparent` provides the W3C trace context when you enable [`propagate_traceparent`](https://docs.sentry.io/platforms/godot/configuration/options.md#propagate_traceparent).

Restrict headers to your own services with [Limiting Trace Propagation](https://docs.sentry.io/platforms/godot/tracing/distributed-tracing/limiting-trace-propagation.md). For Web exports, also configure your backend to [allow the headers through CORS](https://docs.sentry.io/platforms/godot/tracing/distributed-tracing/dealing-with-cors-issues.md).

Make sure any proxies, gateways, or firewalls between your game and backend preserve the tracing headers.

## [Trace Duration](https://docs.sentry.io/platforms/godot/tracing/distributed-tracing.md#trace-duration)

The SDK starts a trace when it initializes. Spans and events share that trace until you start a new one. Ending a span finishes only that operation; it doesn't start a new trace.

To separate unrelated work, such as game matches, [start a new trace](https://docs.sentry.io/platforms/godot/tracing/distributed-tracing/custom-trace-propagation.md#start-a-new-trace) before starting the next operation.

## [How Sampling Propagates](https://docs.sentry.io/platforms/godot/tracing/distributed-tracing.md#how-sampling-propagates)

The outgoing `sentry-trace` header carries the span's sampling decision so downstream services can honor it. With [`traces_sample_rate`](https://docs.sentry.io/platforms/godot/configuration/options.md#traces_sample_rate) set to its default of `0.0`, the SDK still provides trace headers, but the span isn't sent and the headers mark the trace as unsampled.

Use a sample rate of `1.0` in your game and backend while verifying the connection, then adjust it for production.

## [Next Steps](https://docs.sentry.io/platforms/godot/tracing/distributed-tracing.md#next-steps)

* #### [Custom Trace Propagation](https://docs.sentry.io/platforms/godot/tracing/distributed-tracing/custom-trace-propagation.md)

  Learn how to attach trace headers to requests and start separate traces in your Godot game.

* #### [Dealing with CORS Issues](https://docs.sentry.io/platforms/godot/tracing/distributed-tracing/dealing-with-cors-issues.md)

  Learn how to allow Sentry trace headers on requests from Godot Web exports to your backend.

* #### [Limiting Trace Propagation](https://docs.sentry.io/platforms/godot/tracing/distributed-tracing/limiting-trace-propagation.md)

  Learn how to restrict outgoing trace headers to trusted backend services in your Godot game.

## Pages in this section

- [Custom Trace Propagation](https://docs.sentry.io/platforms/godot/tracing/distributed-tracing/custom-trace-propagation.md)
- [Dealing with CORS Issues](https://docs.sentry.io/platforms/godot/tracing/distributed-tracing/dealing-with-cors-issues.md)
- [Limiting Trace Propagation](https://docs.sentry.io/platforms/godot/tracing/distributed-tracing/limiting-trace-propagation.md)
