fix: cap tab navigation span duration to drop idle-inflated telemetry#95781
Draft
BartekObudzinski wants to merge 1 commit into
Draft
fix: cap tab navigation span duration to drop idle-inflated telemetry#95781BartekObudzinski wants to merge 1 commit into
BartekObudzinski wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
The five slowest
ManualNavigateToInboxTabspans in production over the last 14 days are 2.0h, 50.7min, 45.1min, 32.6min and 18.1min (releases 9.4.21-9 through 9.4.28-2, across Windows, macOS and iOS). None of them measure a navigation: their traces show zero JS, network or interaction activity for the entire span window, and each span ends at the moment the client resumes. The clearest example is an 18-minute span whose end shares a timestamp with an 89msManualOpenReportspan, so the client and API were fast the moment the user actually interacted. In the last 14 days, 188 productionManualNavigateToInboxTabspans exceeded 60s while the real p99 is ~1.5s.Span durations are wall-clock. A machine sleep, frozen browser tab, or suspended mobile app between the tab click (span start in
InboxTabButton) and the end signal (useInboxTabSpanLifecycleonLayout/focus, or a cancel) inflates the duration to the length of the idle gap. #95480 already drops the spans that exit throughcancelSpan(canceled: true), but a stale span that ends through the regularendSpanpath after the app wakes up (sidebar layout or focus firing on resume) is not canceled and still ships with the idle gap as its duration.The fix extends
maxDurationFilter, which previously only applied toSubmitToDestinationVisiblewith a 60s cap, to also cover the tab-navigation ops (TAB_NAVIGATION_SPAN_IDS). It now filters both root transactions and adopted child spans, mirroring the structure ofcanceledTabNavigationFilter. The 60s cap is 40x the tab-navigation p99, so no legitimate navigation measurement is dropped. This is a telemetry send-time filter only, with no change to app behavior.Note for metric consumers:
ManualNavigateToInboxTabandManualNavigateToReports*max/p99.9 will drop definitionally once this deploys, because multi-minute idle artifacts stop shipping.Fixed Issues
$
PROPOSAL:
Tests
npx jest tests/unit/maxDurationFilterTest.tsand verify all tests pass. The over-cap paths (root transaction and child span) can only be produced synthetically, so they are covered there.[Sentry][ManualNavigateToInboxTab] Ending spanappears and theManualNavigateToInboxTabtransaction is still present in the Sentry envelope requests (normal sub-cap spans are unaffected).ManualNavigateToReports*spans are likewise still sent.Offline tests
N/A
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari