Track Ajax requests in performance bar
At the moment, we have a lovely performance bar that tracks timings on the current page: https://docs.gitlab.com/ee/administration/monitoring/performance/performance_bar.html
This is incredibly helpful for digging in to performance issues. However, as we move more requests to getting JSON using XHR, this becomes less useful, because the performance bar doesn't work for those requests.
In https://github.com/peek/peek/pull/30 you can see how peek (roughly) got to where it is today: it uses the request ID to fetch metrics after getting.
I feel like it would be possible to do this for XHR, too:
- If the performance bar is enabled for this user, add the request ID as a header in response to any XHR requests, too.
- On the frontend, we could then get the header and do the same request that peek does (to
-/peek/results
), to get the metrics for this request. - We'd then somehow merge those, or even allow you to pick a request in the bar.