fix(vue): Start pageload transaction earlier to capture missing spans #5983
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.
This PR makes the
pageload
transaction start a little earlier in the Vue routing instrumentation, allowing our SDK to add the rootui.vue.render
span and a few missed child component spans to the now available and active transaction.Previously, in our Vue routing instrumentation, the
pageload
transaction would only be created when thebeforeEach
hook of the Vue router was called for the first time. This worked reasonably well in Vue 2 apps where this hook was called before any components were rendered. However, in Vue 3 (Vue router v3 and v4) it seems like the routing/rendering process was changed so that the root component would be rendered before the initialbeforeEach
router hook call.To be clear, this change makes the
pageload
transaction always start with aurl
transaction source (because we don't yet have a matched route at this stage). However, it is updated to a more high-quality source later on - exactly at the time where we previously used to start the transaction. IMO this is fine because by now we've realized that the timing problem of transaction names in DSC propagation requires more fundamental changes. Furthermore, this increases the quality of the pageload transaction, as it is now showing a more representative starting time. This matches the behaviour of other routing instrumentations, such as Angular or Express.fixes #5910