ref(browser): Ensure start time of interaction root and child span is aligned #14188
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 replaces the manual start and end calls for interaction child spans with our
startAndEndSpan
helper.Using
startAndEndSpan
also will adjust the root span's start time stamp if the (in this case interaction-) child span starts earlier than the parent span. I think in this particular case, this is fine or even desireable because my testing so far has shown that the performance entry we use for the child spans starts a couple of ms earlier than the surrounding idle interaction transaction. We can add a similar check as in #14183 or #14186 if this becomes a problem.Further context: If users enable
experiments.enableInteractions
, for every click, we create:EDIT: Initially, I did this to reduce bundle size but it looks like this actually isn't happening. On the plus side, I think the behaviour change is still worth to merge in and the size increase is negligible. Maybe, it's even within the usual margin of error of our size check. Anyway, the code change is the same, I just re-purposed the PR a bit 😅