Skip to content

Bug 2007005 - Automatically mirror the bug status to the alert status in our database#9401

Merged
gmierz merged 1 commit into
mozilla:masterfrom
junngo:sync-perf-alert-status
May 19, 2026
Merged

Bug 2007005 - Automatically mirror the bug status to the alert status in our database#9401
gmierz merged 1 commit into
mozilla:masterfrom
junngo:sync-perf-alert-status

Conversation

@junngo
Copy link
Copy Markdown
Contributor

@junngo junngo commented Apr 14, 2026

This PR syncs the alert summary status between the Treeherder database and Bugzilla.
It searches for bugs from Bugzilla with the following conditions:

  • Keyword: perf-alert
  • Resolution changed within the last 7 days

The bug statuses are then mirrored into the Treeherder database.
If you have any feedback on the query conditions or other improvements, feel free to share.

Bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=2007005

Comment thread treeherder/perf/auto_perf_sheriffing/performance_alerting/alert_modifier.py Outdated
@junngo junngo force-pushed the sync-perf-alert-status branch 2 times, most recently from 16740bb to 81c43cb Compare April 16, 2026 13:45
Copy link
Copy Markdown
Contributor Author

@junngo junngo left a comment

Choose a reason for hiding this comment

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

I've added a new bug_status field to mirror the bug resolution from bugzilla. If you have any questions or feedback, feel free to let me know.

continue
new_bug_status = bug_status_map.get(bug["resolution"])
if new_bug_status is None and bug["resolution"] == "":
new_bug_status = PerformanceAlertSummary.BUG_NEW
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If the status is changed to ASSIGNED or REOPENED, the resolution is empty. In this case, we set it to
the NEW case. Is this the correct behavior?
Also, if the resolution is not mapped (line 73), we skip it. Is this correct as well?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Oh good catch! Yes, let's default to NEW in that case.

Comment thread treeherder/perf/models.py
(BUG_INCOMPLETE, "INCOMPLETE"),
(BUG_MOVED, "MOVED"),
)
bug_status = models.IntegerField(choices=BUG_STATUSES, null=True, default=None)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  • I've added the bug status fields to the PerformanceAlertSummary table only, not to the base class (PerformanceAlertSummaryBase), to avoid adding unnecessary fields to PerformanceTelemetryAlertSummary and PerformanceAlertSummaryTesting.
  • I've added the BUG_ prefix to avoid ambiguity, since PerformanceAlertSummaryBase already has FIXED, INVALID, WONTFIX etc. in its STATUSES.
  • I've also defined these statuses independently rather than reusing PerformanceTelemetryAlert's statuses to avoid unnecessary coupling between the two models.

@junngo junngo force-pushed the sync-perf-alert-status branch from 81c43cb to 73c0ef4 Compare May 4, 2026 14:51
@junngo
Copy link
Copy Markdown
Contributor Author

junngo commented May 4, 2026

Thanks for the review, everyone :)
I've rebased the PR again. Please let me know if you have any questions or feedback.

@beatrice-acasandrei
Copy link
Copy Markdown
Collaborator

Thank you! Currently, the new bug status is not reflected in the user interface in any way. If the summary has a regression bug where the status is "fixed" for example, the summary's status will still be displayed as "investigating". @junngo Could you please create a follow-up ticket to display the bug's actual status (if it differs from "new") instead of the summary's "investigating" status?

@junngo
Copy link
Copy Markdown
Contributor Author

junngo commented May 6, 2026

Thanks @beatrice-acasandrei
I've created a follow-up bug for this: https://bugzilla.mozilla.org/show_bug.cgi?id=2037299

@junngo junngo force-pushed the sync-perf-alert-status branch from 73c0ef4 to 9bd9848 Compare May 19, 2026 16:08
@gmierz gmierz merged commit 59f11a1 into mozilla:master May 19, 2026
7 checks passed
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.

3 participants