fix(waterfall): Relax "next_trace" lookup to just the trace id #104047
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.
For the "Next Trace" button, we'd previously, search for spans matching the exact trace and span id of the current trace root span. However, in some cases, the product considers another span the trace root span than our SDK. An example is a web vital (INP) span, which happened slightly before the navigation span started but was only added by the SDK retroactively. In the product, we consider the web vital span the trace root, while in the SDK we assigned the previous_trace span link to the navigation span.
To still correctly find the next trace span, this PR now relaxes the search criteria for the next trace, to search for a span with the
previous_traceattribute containing the current trace's traceId, but any spanId. This works well as long as there's only oneprevious_tracespan link per trace. If there are multiple, we'd take the first one, which also isn't the end of the world. However, in the SDK, we make sure to only set the link once per trace. => I think this works well enough.h/t @bcoe for the "contains" idea 🙏