Description
While working on #10633, I noticed that both the Angular and the SvelteKit routing instrumentation rely on the following behavior:
function onRouteStart(route) {
if(!getActiveSpan()) {
startBrowserTracingNavigationSpan(...);
}
}
The idea there is to avoid creating the navigation span when the initial page load span is ongoing. However, this check is actually incorrect, because it will also drop any navigation that actually happens while an idle pageload/navigation span is ongoing.
We should change these checks in Angular & SvelteKit to better check what we want to check. Something like this could work (simplified, but to get the idea):
let hadPageLoadRoute = false;
function onRouteStart(route) {
if(hadPageLoadRoute) {
startBrowserTracingNavigationSpan(...);
} else {
hadPageLoadRoute = true;
}
}
but this relies on the semantics of the router, if/when/how it calls onRouteStart
for the initial page load, etc - so this is rather framework specific.
We should also add E2E tests for this, testing that if you navigate quickly between pages, all the pageload/navigation transactions are correctly created.