Skip to content

Commit d26e6fa

Browse files
committed
Update Performancebug rules and Template
1 parent e958446 commit d26e6fa

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed

bugbot/rules/performancebug.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class PerformanceBug(BzCleaner):
1111
def __init__(self):
1212
super().__init__()
13-
self.autofix_performance_impact = {}
13+
self.autofix_bugs = []
1414

1515
def description(self):
1616
return "[Using ML] Bugs with Missing Performance Impact"
@@ -65,6 +65,9 @@ def get_bugs(self, date="today", bug_ids=[]):
6565
bug = raw_bugs[bug_id]
6666
prob = bug_data["prob"]
6767

68+
if prob[1] < 0.2:
69+
continue
70+
6871
results[bug_id] = {
6972
"id": bug_id,
7073
"summary": bug["summary"],
@@ -75,12 +78,23 @@ def get_bugs(self, date="today", bug_ids=[]):
7578
# Only autofix results for which we are sure enough.
7679
if prob[1] >= self.get_config("confidence_threshold"):
7780
results[bug_id]["autofixed"] = True
78-
self.autofix_performance_impact[bug_id] = {"cf_performance_impact": "?"}
81+
self.autofix_bugs.append((bug_id, prob[1]))
7982

8083
return results
8184

8285
def get_autofix_change(self):
83-
return self.autofix_performance_impact
86+
autofix_change = {}
87+
for bug_id, confidence in self.autofix_bugs:
88+
autofix_change[bug_id] = {
89+
"cf_performance_impact": "?",
90+
}
91+
92+
if confidence != 1.0:
93+
autofix_change[bug_id]["comment"] = {
94+
"body": "The [Bugbug](https://github.com/mozilla/bugbug/) bot thinks this bug is a performance bug, but please revert this change in case of error."
95+
}
96+
97+
return autofix_change
8498

8599

86100
if __name__ == "__main__":

configs/rules.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,11 @@
419419
"confidence_threshold": 0.95,
420420
"cc": []
421421
},
422+
"performancebug": {
423+
"max_days_in_cache": 7,
424+
"days_lookup": 7,
425+
"confidence_threshold": 0.9
426+
},
422427
"stepstoreproduce": {
423428
"max_days_in_cache": 7,
424429
"days_lookup": 3,

templates/performancebug.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<p>
2+
The following {{ plural('bug is', data, pword='bugs are') }} probably performance related and {{ plural('doesn\'t', data, pword='don\'t') }} have performance impact value:
3+
</p>
4+
<table {{ table_attrs }}>
5+
<thead>
6+
<tr>
7+
<th>Bug</th>
8+
<th>Summary</th>
9+
<th>Confidence (%)</th>
10+
</tr>
11+
</thead>
12+
<tbody>
13+
{% for i, (bugid, summary, confidence, autofixed) in enumerate(data) -%}
14+
<tr {% if i % 2 == 0 %}bgcolor="#E0E0E0"
15+
{% endif -%}
16+
>
17+
<td>
18+
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id={{ bugid }}">{{ bugid }}</a>
19+
</td>
20+
<td>{{ summary | e }}</td>
21+
<td {% if autofixed %}bgcolor="#00FF00"{% endif -%}>{{ confidence }}</td>
22+
</tr>
23+
{% endfor -%}
24+
</tbody>
25+
</table>

0 commit comments

Comments
 (0)