Skip to content

Bug 2009828 - Avoid duplicate common alert summary requests#9243

Open
junngo wants to merge 1 commit intomozilla:masterfrom
junngo:common-alerts-dedup
Open

Bug 2009828 - Avoid duplicate common alert summary requests#9243
junngo wants to merge 1 commit intomozilla:masterfrom
junngo:common-alerts-dedup

Conversation

@junngo
Copy link
Contributor

@junngo junngo commented Feb 20, 2026

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

@beatrice-acasandrei
Copy link
Collaborator

beatrice-acasandrei commented Feb 23, 2026

A check is failing on CircleCI, perhaps a rebase will fix that.

@junngo junngo force-pushed the common-alerts-dedup branch from a492ff4 to bf27e80 Compare February 24, 2026 02:49
@junngo
Copy link
Contributor Author

junngo commented Feb 24, 2026

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];
Copy link
Collaborator

@beatrice-acasandrei beatrice-acasandrei Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

commonAlert: reduceDictToKeys(
commonAlerts[0].find((alert) => alert.push_id === dataPoint.push_id),
['id', 'status'],
),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants