• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / relman-auto-nag / #4872

21 Dec 2023 04:02PM UTC coverage: 21.803%. Remained the same
#4872

push

coveralls-python

PromiseFru
Added `creation_ts` to params

716 of 3602 branches covered (0.0%)

0 of 1 new or added line in 1 file covered. (0.0%)

2 existing lines in 1 file now uncovered.

1928 of 8843 relevant lines covered (21.8%)

0.22 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/bugbot/rules/performancebug.py
1
# This Source Code Form is subject to the terms of the Mozilla Public
2
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
3
# You can obtain one at http://mozilla.org/MPL/2.0/.
4

5
from bugbot.bugbug_utils import get_bug_ids_classification
×
6
from bugbot.bzcleaner import BzCleaner
×
7
from bugbot.utils import nice_round
×
8

9

10
class PerformanceBug(BzCleaner):
×
11
    def __init__(self):
×
12
        super().__init__()
×
13
        self.autofix_performance_impact = {}
×
14

15
    def description(self):
×
16
        return "[Using ML] Bugs with Missing Performance Impact"
×
17

18
    def columns(self):
×
19
        return ["id", "summary", "confidence", "autofixed"]
×
20

21
    def get_bz_params(self, date):
×
NEW
22
        start_date, _ = self.get_dates(date)
×
23

UNCOV
24
        params = {
×
25
            "include_fields": ["id", "summary"],
26
            "f1": "creation_ts",
27
            "o1": "greaterthan",
28
            "v1": start_date,
29
            "f2": "keywords",
30
            "o2": "nowords",
31
            "v2": "perf,topperf,main-thread-io",
32
            "f3": "cf_performance_impact",
33
            "o3": "equals",
34
            "v3": ["---"],
35
        }
36

37
        return params
×
38

39
    def get_bugs(self, date="today", bug_ids=[]):
×
40
        # Retrieve the bugs with the fields defined in get_bz_params
41
        raw_bugs = super().get_bugs(date=date, bug_ids=bug_ids, chunk_size=7000)
×
42

43
        if len(raw_bugs) == 0:
×
44
            return {}
×
45

46
        # Extract the bug ids
47
        bug_ids = list(raw_bugs.keys())
×
48

49
        # Classify those bugs
50
        bugs = get_bug_ids_classification("performancebug", bug_ids)
×
51

52
        results = {}
×
53

54
        for bug_id in sorted(bugs.keys()):
×
55
            bug_data = bugs[bug_id]
×
56

57
            if not bug_data.get("available", True):
×
58
                # The bug was not available, it was either removed or is a
59
                # security bug
60
                continue
×
61

62
            if not {"prob", "index"}.issubset(bug_data.keys()):
×
63
                raise Exception(f"Invalid bug response {bug_id}: {bug_data!r}")
×
64

65
            bug = raw_bugs[bug_id]
×
66
            prob = bug_data["prob"]
×
67

UNCOV
68
            results[bug_id] = {
×
69
                "id": bug_id,
70
                "summary": bug["summary"],
71
                "confidence": nice_round(prob[1]),
72
                "autofixed": False,
73
            }
74

75
            # Only autofix results for which we are sure enough.
76
            if prob[1] >= self.get_config("confidence_threshold"):
×
77
                results[bug_id]["autofixed"] = True
×
78
                self.autofix_performance_impact[bug_id] = {"cf_performance_impact": "?"}
×
79

80
        return results
×
81

82
    def get_autofix_change(self):
×
83
        return self.autofix_performance_impact
×
84

85

86
if __name__ == "__main__":
×
87
    PerformanceBug().run()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc