Skip to content
Merged
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
31 changes: 31 additions & 0 deletions docs/platforms/android/tracing/trace-propagation/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,34 @@ If you run any JavaScript applications in your distributed system, make sure tha
<PlatformContent includePath="distributed-tracing/how-to-use/" />

Remember that in order to propagate trace information through your whole distributed system, you have to use Sentry in all of the involved services and applications. Take a look at the respective SDK documentation to learn how distributed tracing can be enabled for each platform.

### tracePropagationTargets

The Android SDK will attach the `sentry-trace` and `baggage` headers to all outgoing requests by default. To narrow
this down to only specific URLs, add those URLs to the `tracePropagationTargets` allowlist, (you can use both
strings and regexes). The SDK will then only attach the `sentry-trace` and `baggage` headers to outgoing requests matching the allowlist.

<Alert>
The `tracePropagationTargets` option can contain full URLs (e.g. `"https://api.myproject.org/request/path"`), sub-strings (e.g. `"api.myproject.org"`) or regular expressions (e.g. `"https://[\w]*\.myproject\.org/.*"`).
</Alert>

Since the value of `tracePropagationTargets` is `".*"` by default, tracing headers are attached to all requests unless otherwise specified.

```java {tabTitle:Java}
SentryAndroid.init(context, options -> {
final ArrayList<String> tracePropagationTargets = new ArrayList<>();
tracePropagationTargets.add("https://api.myproject.org/");

options.setDsn("___PUBLIC_DSN___");
options.setTracePropagationTargets(tracePropagationTargets);
});
```

```kotlin {tabTitle:Kotlin}
SentryAndroid.init(context, { options ->
options.setDsn("___PUBLIC_DSN___")
options.setTracePropagationTargets(listOf(
"https://api.myproject.org/"
))
})
```
31 changes: 31 additions & 0 deletions docs/platforms/java/common/tracing/trace-propagation/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,34 @@ If you run any JavaScript applications in your distributed system, make sure tha
<PlatformContent includePath="distributed-tracing/how-to-use/" />

Remember that in order to propagate trace information through your whole distributed system, you have to use Sentry in all of the involved services and applications. Take a look at the respective SDK documentation to learn how distributed tracing can be enabled for each platform.

### tracePropagationTargets

The Java SDK will attach the `sentry-trace` and `baggage` headers to all outgoing requests by default. To narrow
this down to only specific URLs, add those URLs to the `tracePropagationTargets` allowlist, (you can use both
strings and regexes). The SDK will then only attach the `sentry-trace` and `baggage` headers to outgoing requests matching the allowlist.

<Alert>
The `tracePropagationTargets` option can contain full URLs (e.g. `"https://api.myproject.org/request/path"`), sub-strings (e.g. `"api.myproject.org"`) or regular expressions (e.g. `"https://[\w]*\.myproject\.org/.*"`).
</Alert>

Since the value of `tracePropagationTargets` is `".*"` by default, tracing headers are attached to all requests unless otherwise specified.

```java {tabTitle:Java}
Sentry.init(context, options -> {
final ArrayList<String> tracePropagationTargets = new ArrayList<>();
tracePropagationTargets.add("https://api.myproject.org/");

options.setDsn("___PUBLIC_DSN___");
options.setTracePropagationTargets(tracePropagationTargets);
});
```

```kotlin {tabTitle:Kotlin}
Sentry.init(context, { options ->
options.setDsn("___PUBLIC_DSN___")
options.setTracePropagationTargets(listOf(
"https://api.myproject.org/"
))
})
```