-
-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Dont create transaction for unused ViewControllers #4437
Changes from all commits
d84a989
1c45023
288c2bc
f47d7c6
35ee4ac
734f4f3
a554a06
39db8d1
ce99e69
f608ba3
e2cba58
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,6 +132,7 @@ class SentryUIViewControllerPerformanceTrackerTests: XCTestCase { | |
callbackExpectation.fulfill() | ||
} | ||
let tracer = try XCTUnwrap(transactionSpan as? SentryTracer) | ||
XCTAssertTrue(tracer.shouldIgnore) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This addition are meant to check whether The test to check whether we create or not the transaction can be found in |
||
XCTAssertEqual(tracer.transactionContext.name, fixture.viewControllerName) | ||
XCTAssertEqual(tracer.transactionContext.nameSource, .component) | ||
XCTAssertEqual(tracer.transactionContext.origin, origin) | ||
|
@@ -193,6 +194,7 @@ class SentryUIViewControllerPerformanceTrackerTests: XCTestCase { | |
|
||
lifecycleEndingMethod(sut, viewController, tracker, callbackExpectation, tracer) | ||
|
||
XCTAssertFalse(tracer.shouldIgnore) | ||
XCTAssertEqual(Dynamic(transactionSpan).children.asArray!.count, 8) | ||
XCTAssertTrue(tracer.isFinished) | ||
XCTAssertEqual(finishStatus.rawValue, tracer.status.rawValue) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
h
: If I'm not mistaken, this approach won't work for nested UIViewControllers, as this would only remove the spans forloadView
andviewDidLoad
and not the other spans, such as TTID/TTFD.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TTID and TTFD are not created for nested view controllers.
Im not sure if I understood your point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, TTID/TTFD was a bad example then. What about other spans, such as file IO, DB queries, manually added ones, or other future spans that we aren't yet aware of?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I can see where this could happen.
What do you think we should do to them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validation idea mentioned in the top-level comment sounds promising 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brustolin, I would suggest a validation logic as described here #4437 (review). WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably need to talk about this in person, maybe I didn't get it but your suggestion in the PR review comment does not solve the problem raised in here.
Also, I would not like to have a "scenario specific" logic inside the generic SentryTracer class, it feels more hacky than the one flag solution that indicates whether the span was validated by its creator or not.