From 5a1591a31ebdea217272b99e5cc49e1daeaba0b6 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Thu, 14 Nov 2024 11:06:18 +0100 Subject: [PATCH 1/2] feat(apple): Explain UIViewController scope logic Explain how the SDK decides on the parent-child relationship for UIViewController transactions and which UIViewController transactions to put on the scope. --- .../tracing/instrumentation/automatic-instrumentation.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx b/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx index fe4fbf68e242a..de1f944867562 100644 --- a/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx +++ b/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx @@ -29,6 +29,8 @@ The SDK creates spans to provide insight into the time consumed by each of the m ![`UIViewController` Transaction](./img/ui-view-controller-transaction.png) +For nested UIViewControllers, the SDK creates a parent-child relationship in the transaction based on which UIViewController your app loads first. The SDK starts a new UIViewController transaction and binds it to the scope when there is no active transaction on the scope yet, except for [user interaction](#user-interaction-tracing) transactions, which the SDK finishes and removes from the scope when starting a new UIViewController transaction. As long as the UIViewController transaction is on the scope, the SDK starts new UIViewController spans as child spans of the UIViewController on the scope so that you can see all UIViewControllers of a screen in one transaction. When the SDK wants to start a new UIViewController transaction, and there is already a transaction bound to the scope, which can be the case if you do that manually, the SDK doesn't bind the transaction to the scope. So, the UIViewController transaction will function normally, but it will miss other auto-generated performance spans, such as HTTP, file IO, or core data spans because the SDK adds these to the transaction bound to the scope. + To disable the `UIViewController` Tracing: From 869fc4102e72e078e235c06f4197045002d69337 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Fri, 15 Nov 2024 13:20:44 +0100 Subject: [PATCH 2/2] Update docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx Co-authored-by: Liza Mock --- .../tracing/instrumentation/automatic-instrumentation.mdx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx b/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx index de1f944867562..336a7f4ee52fc 100644 --- a/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx +++ b/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx @@ -29,7 +29,13 @@ The SDK creates spans to provide insight into the time consumed by each of the m ![`UIViewController` Transaction](./img/ui-view-controller-transaction.png) -For nested UIViewControllers, the SDK creates a parent-child relationship in the transaction based on which UIViewController your app loads first. The SDK starts a new UIViewController transaction and binds it to the scope when there is no active transaction on the scope yet, except for [user interaction](#user-interaction-tracing) transactions, which the SDK finishes and removes from the scope when starting a new UIViewController transaction. As long as the UIViewController transaction is on the scope, the SDK starts new UIViewController spans as child spans of the UIViewController on the scope so that you can see all UIViewControllers of a screen in one transaction. When the SDK wants to start a new UIViewController transaction, and there is already a transaction bound to the scope, which can be the case if you do that manually, the SDK doesn't bind the transaction to the scope. So, the UIViewController transaction will function normally, but it will miss other auto-generated performance spans, such as HTTP, file IO, or core data spans because the SDK adds these to the transaction bound to the scope. +### Nested View Controllers + +The SDK sets up a parent-child relationship for nested UIViewControllers, starting with the first UIViewController that your app loads. If there's no active transaction on the scope, the SDK will start a new UIViewController transaction and bind it to the scope unless there's a [user interaction](#user-interaction-tracing) transaction already on the scope, in which case this will be closed and removed first. + +While a UIViewController transaction is active on the scope, the SDK will add any new UIViewController spans as child spans of that active transaction. This creates a unified view of all UIViewControllers on a screen in a single transaction. + +If another transaction is already bound to the scope (if it's been set manually, for example) the SDK won't be able to bind a new UIViewController transaction to the scope. This means that the new transaction will work, but won’t capture other auto-generated spans, like HTTP, file IO, or Core Data, which can only be added to transactions that are bound to the scope. To disable the `UIViewController` Tracing: