From 363e12b48909464570234765f5239ee0072ffc91 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Mon, 12 Feb 2024 15:24:52 +0100 Subject: [PATCH 1/3] fix(apple): Clarify trace propagation targets The trace propagation target code sample was in the section of distributed tracing without an explanation, making the distributed tracing docs for Apple confusing. This is fixed now by adding an explanation and moving the trace propagation target below the distributed tracing section. --- .../usage/distributed-tracing/index.mdx | 35 +++++++++++++++++++ .../distributed-tracing/how-to-use/apple.mdx | 24 ------------- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/docs/platforms/apple/common/usage/distributed-tracing/index.mdx b/docs/platforms/apple/common/usage/distributed-tracing/index.mdx index 39db7c3cab6ac..f2ff418e0310a 100644 --- a/docs/platforms/apple/common/usage/distributed-tracing/index.mdx +++ b/docs/platforms/apple/common/usage/distributed-tracing/index.mdx @@ -32,3 +32,38 @@ If you run any JavaScript applications in your distributed system, make sure tha 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 + +Per default, the Cocoa SDK will attach the `sentry-trace` and `baggage` headers to all outgoing requests. You +can use the allowlist `tracePropagationTargets` to specify to which URLs the Cocoa SDK should send these headers. +You can put string or regexes into the allowlist, and the SDK then only attaches the `sentry-trace` and `baggage` +headers to all outgoing requests whose destination contains a string in the list or matches a regex in the list. + +**The `tracePropagationTargets` option matches the entire request URL, not just the domain. Using stricter regex to match certain parts of the URL ensures that requests don't unnecessarily have additional headers attached.** + +The default value of `tracePropagationTargets` is `['.*']`. This means that by default, tracing headers are attached to all requests. + +```swift {tabTitle:Swift} +import Sentry + +SentrySDK.start { options in + options.dsn = "___PUBLIC_DSN___" + options.tracePropagationTargets = [ + "https://myproject.org", + "https://api.otherservice.org/", + ] +} +``` + +```objc {tabTitle:Objective-C} +@import Sentry; + +[SentrySDK startWithConfigureOptions:^(SentryOptions *options) { + options.dsn = @"___PUBLIC_DSN___"; + options.tracePropagationTargets = @[ + @"https://myproject.org", + @"https://api.otherservice.org/" + ]; +}]; +``` diff --git a/platform-includes/distributed-tracing/how-to-use/apple.mdx b/platform-includes/distributed-tracing/how-to-use/apple.mdx index d3b128999971e..672102cda51ae 100644 --- a/platform-includes/distributed-tracing/how-to-use/apple.mdx +++ b/platform-includes/distributed-tracing/how-to-use/apple.mdx @@ -1,27 +1,3 @@ If you're using the current version of our Cocoa SDK, distributed tracing will work out of the box. -```swift {tabTitle:Swift} -import Sentry - -SentrySDK.start { options in - options.dsn = "___PUBLIC_DSN___" - options.tracePropagationTargets = [ - "https://myproject.org", - "https://api.otherservice.org/", - ] -} -``` - -```objc {tabTitle:Objective-C} -@import Sentry; - -[SentrySDK startWithConfigureOptions:^(SentryOptions *options) { - options.dsn = @"___PUBLIC_DSN___"; - options.tracePropagationTargets = @[ - @"https://myproject.org", - @"https://api.otherservice.org/" - ]; -}]; -``` - If you're using version `8.10.x` or below, you'll need to have our Network Tracking feature enabled in order for distributed tracing to work. From c1be0005d45a6ec28999f0db4904ce5d369a8f66 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Tue, 13 Feb 2024 11:06:49 +0100 Subject: [PATCH 2/3] Update docs/platforms/apple/common/usage/distributed-tracing/index.mdx Co-authored-by: Liza Mock --- docs/platforms/apple/common/usage/distributed-tracing/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/apple/common/usage/distributed-tracing/index.mdx b/docs/platforms/apple/common/usage/distributed-tracing/index.mdx index f2ff418e0310a..a717c403524f5 100644 --- a/docs/platforms/apple/common/usage/distributed-tracing/index.mdx +++ b/docs/platforms/apple/common/usage/distributed-tracing/index.mdx @@ -42,7 +42,7 @@ headers to all outgoing requests whose destination contains a string in the list **The `tracePropagationTargets` option matches the entire request URL, not just the domain. Using stricter regex to match certain parts of the URL ensures that requests don't unnecessarily have additional headers attached.** -The default value of `tracePropagationTargets` is `['.*']`. This means that by default, tracing headers are attached to all requests. +Since the value of `tracePropagationTargets` is `['.*']` by default, tracing headers are attached to all requests unless otherwise specified. ```swift {tabTitle:Swift} import Sentry From 5240adca158c921ba7e1746811e841c273a99117 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Tue, 13 Feb 2024 11:08:39 +0100 Subject: [PATCH 3/3] wording suggestions and note --- .../common/usage/distributed-tracing/index.mdx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/platforms/apple/common/usage/distributed-tracing/index.mdx b/docs/platforms/apple/common/usage/distributed-tracing/index.mdx index a717c403524f5..26729222f5ce4 100644 --- a/docs/platforms/apple/common/usage/distributed-tracing/index.mdx +++ b/docs/platforms/apple/common/usage/distributed-tracing/index.mdx @@ -35,12 +35,14 @@ Remember that in order to propagate trace information through your whole distrib ### tracePropagationTargets -Per default, the Cocoa SDK will attach the `sentry-trace` and `baggage` headers to all outgoing requests. You -can use the allowlist `tracePropagationTargets` to specify to which URLs the Cocoa SDK should send these headers. -You can put string or regexes into the allowlist, and the SDK then only attaches the `sentry-trace` and `baggage` -headers to all outgoing requests whose destination contains a string in the list or matches a regex in the list. - -**The `tracePropagationTargets` option matches the entire request URL, not just the domain. Using stricter regex to match certain parts of the URL ensures that requests don't unnecessarily have additional headers attached.** +The Cocoa 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 +string and regexes). The SDK will then only attach the `sentry-trace` and `baggage` headers to outgoing requests +whose destination either contains a string or matches a regex in your allowlist. + + +The `tracePropagationTargets` option matches the entire request URL, not just the domain. Using stricter regex to match certain parts of the URL ensures that requests don't unnecessarily have additional headers attached. + Since the value of `tracePropagationTargets` is `['.*']` by default, tracing headers are attached to all requests unless otherwise specified.