Bug 2009828 - Avoid duplicate common alert summary requests#9243
Bug 2009828 - Avoid duplicate common alert summary requests#9243junngo wants to merge 1 commit intomozilla:masterfrom
Conversation
|
A check is failing on CircleCI, perhaps a rebase will fix that. |
a492ff4 to
bf27e80
Compare
|
Thanks! I submitted the pr again after rebasing. CI failure was removed. |
| const commonAlertsFlat = (await Promise.all( | ||
| uniqueFrameworkIds.map(id => this.getCommonAlerts(id, timeRange.value)) | ||
| )).flat(); | ||
| const commonAlerts = [commonAlertsFlat]; |
There was a problem hiding this comment.
I'd like to merge this, but I still have a quick question. You're now flattening the results into commonAlertsFlat and then wrapping it in an array [commonAlertsFlat]. The original code returned an array of results mapped 1:1 to seriesData. Does the downstream logic expect this single combined list, or do we still need to maintain the mapping for each series? Just want to make sure this matches the expected type.
There was a problem hiding this comment.
Thanks for the review :)
Sorry about that. I should have explained this earlier. Yes, the result format has changed.
Before:
[ [alertsA], [alertsB], [alertsC],]
After:
[ [alertA, alertB, alertC,] ]
The change is intentional. createGraphData only uses commonAlerts[0], so returning one combined list matches how the data is used. The previous code also effectively relied on the first entry.
If you’d prefer preserving the 1:1 mapping for clarity, I can keep the previous shape.
[0]
treeherder/ui/perfherder/perf-helpers/helpers.js
Lines 841 to 844 in 5b1819b
When multiple tests are added, the graphs page becomes very slow.
The alert summary API [1] takes around 2~4 seconds per request, and the same API was being called repeatedly based on the number of added tests.
For example, when four tests are added [0], the page load time increases to about 10 seconds.
This patch deduplicates the alert summary API calls and ensures the API is called only once per framework.
Related bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=2009828
[0]
https://treeherder.mozilla.org/perfherder/graphs?highlightAlerts=1&highlightChangelogData=0&highlightCommonAlerts=0&replicates=1&series=autoland,5257392,1,13&series=autoland,5257402,1,13&series=autoland,5257592,1,13&series=autoland,5257591,1,13&timerange=604800
[1]
https://treeherder.mozilla.org/api/performance/alertsummary/?framework=13&limit=30&timerange=604800