Skip to content

Commit fb59b00

Browse files
authored
Bug 1919588 - Add a new testing alert table, along with new fields. (#8200)
* Bug 1919588 - Add a new testing alert table, along with new fields. * Change naming of PerformanceAlertSummary* class variable. * Check if reassigned alerts are part of current summary when autodetermining status. * Resolve broken tests.
1 parent 57537ac commit fb59b00

File tree

4 files changed

+350
-37
lines changed

4 files changed

+350
-37
lines changed

tests/perfalert/test_alert_modification.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ def test_reassigning_regression(
101101

102102
assert s.status == PerformanceAlertSummary.UNTRIAGED
103103

104-
# reassigning a regression to the initial summary
105-
# which contains only an improvement
106-
create_perf_alert(
104+
# reassigning a regression that was in the first summary
105+
# to the second summary should leave the status as UNTRIAGED
106+
reassigned_alert = create_perf_alert(
107107
summary=s,
108108
series_signature=signature1,
109109
related_summary=test_perf_alert_summary_2,
@@ -117,9 +117,12 @@ def test_reassigning_regression(
117117
# the regression alert will keep it's status of REASSIGNED
118118
untriaged_improvement_alert.status = PerformanceAlert.ACKNOWLEDGED
119119
untriaged_improvement_alert.save()
120+
assert reassigned_alert.status == PerformanceAlert.REASSIGNED
120121

122+
# Status of the summary with only improvements should automatically
123+
# have a status of IMPROVEMENT
121124
s = PerformanceAlertSummary.objects.get(id=1)
122-
assert s.status == PerformanceAlertSummary.INVESTIGATING
125+
assert s.status == PerformanceAlertSummary.IMPROVEMENT
123126

124127

125128
def test_improvement_summary_status_after_reassigning_regression(
Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
# Generated by Django 4.2.16 on 2024-09-18 16:26
2+
3+
from django.conf import settings
4+
from django.db import migrations, models
5+
import django.db.models.deletion
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
(
12+
"model",
13+
"0032_rename_failureline_job_guid_repository_failure_lin_job_gui_b67c6d_idx_and_more",
14+
),
15+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
16+
(
17+
"perf",
18+
"0052_rename_performancedatum_repository_signature_push_timestamp_performance_reposit_c9d328_idx_and_more",
19+
),
20+
]
21+
22+
operations = [
23+
migrations.CreateModel(
24+
name="PerformanceAlertSummaryTesting",
25+
fields=[
26+
("id", models.AutoField(primary_key=True, serialize=False)),
27+
("manually_created", models.BooleanField(default=False)),
28+
("notes", models.TextField(blank=True, null=True)),
29+
("created", models.DateTimeField(auto_now_add=True, db_index=True)),
30+
("triage_due_date", models.DateTimeField(default=None, null=True)),
31+
("first_triaged", models.DateTimeField(default=None, null=True)),
32+
("last_updated", models.DateTimeField(auto_now=True, null=True)),
33+
(
34+
"status",
35+
models.IntegerField(
36+
choices=[
37+
(0, "Untriaged"),
38+
(1, "Downstream"),
39+
(2, "Reassigned"),
40+
(3, "Invalid"),
41+
(4, "Improvement"),
42+
(5, "Investigating"),
43+
(6, "Won't fix"),
44+
(7, "Fixed"),
45+
(8, "Backed out"),
46+
],
47+
default=0,
48+
),
49+
),
50+
("bug_number", models.PositiveIntegerField(null=True)),
51+
("bug_due_date", models.DateTimeField(default=None, null=True)),
52+
("bug_updated", models.DateTimeField(null=True)),
53+
(
54+
"assignee",
55+
models.ForeignKey(
56+
null=True,
57+
on_delete=django.db.models.deletion.SET_NULL,
58+
related_name="assigned_alerts_testing",
59+
to=settings.AUTH_USER_MODEL,
60+
),
61+
),
62+
(
63+
"framework",
64+
models.ForeignKey(
65+
on_delete=django.db.models.deletion.CASCADE,
66+
to="perf.performanceframework",
67+
),
68+
),
69+
(
70+
"issue_tracker",
71+
models.ForeignKey(
72+
default=1,
73+
on_delete=django.db.models.deletion.PROTECT,
74+
to="perf.issuetracker",
75+
),
76+
),
77+
(
78+
"prev_push",
79+
models.ForeignKey(
80+
on_delete=django.db.models.deletion.CASCADE,
81+
related_name="+",
82+
to="model.push",
83+
),
84+
),
85+
(
86+
"push",
87+
models.ForeignKey(
88+
on_delete=django.db.models.deletion.CASCADE,
89+
related_name="+",
90+
to="model.push",
91+
),
92+
),
93+
(
94+
"repository",
95+
models.ForeignKey(
96+
on_delete=django.db.models.deletion.CASCADE,
97+
to="model.repository",
98+
),
99+
),
100+
],
101+
options={
102+
"db_table": "performance_alert_summary_testing",
103+
"unique_together": {("repository", "framework", "prev_push", "push")},
104+
},
105+
),
106+
migrations.CreateModel(
107+
name="PerformanceAlertTesting",
108+
fields=[
109+
("id", models.AutoField(primary_key=True, serialize=False)),
110+
("is_regression", models.BooleanField()),
111+
("starred", models.BooleanField(default=False)),
112+
("created", models.DateTimeField(auto_now_add=True, null=True)),
113+
("first_triaged", models.DateTimeField(default=None, null=True)),
114+
("last_updated", models.DateTimeField(auto_now=True, null=True)),
115+
(
116+
"status",
117+
models.IntegerField(
118+
choices=[
119+
(0, "Untriaged"),
120+
(1, "Downstream"),
121+
(2, "Reassigned"),
122+
(3, "Invalid"),
123+
(4, "Acknowledged"),
124+
],
125+
default=0,
126+
),
127+
),
128+
(
129+
"amount_pct",
130+
models.FloatField(
131+
help_text="Amount in percentage that series has changed"
132+
),
133+
),
134+
(
135+
"amount_abs",
136+
models.FloatField(
137+
help_text="Absolute amount that series has changed"
138+
),
139+
),
140+
(
141+
"prev_value",
142+
models.FloatField(
143+
help_text="Previous value of series before change"
144+
),
145+
),
146+
(
147+
"new_value",
148+
models.FloatField(help_text="New value of series after change"),
149+
),
150+
(
151+
"t_value",
152+
models.FloatField(
153+
help_text="t value out of analysis indicating confidence that change is 'real'",
154+
null=True,
155+
),
156+
),
157+
(
158+
"noise_profile",
159+
models.CharField(
160+
choices=[
161+
(
162+
"SKEWED",
163+
"Samples are heavily found on one side of the mean.",
164+
),
165+
(
166+
"OUTLIERS",
167+
"There are more outliers than should be expected from a normal distribution.",
168+
),
169+
(
170+
"MODAL",
171+
"There are multiple areas where most values are found rather than only one.",
172+
),
173+
("OK", "No issues were found."),
174+
("N/A", "Could not compute a noise profile."),
175+
],
176+
default="N/A",
177+
help_text="The noise profile of the data which precedes this alert.",
178+
max_length=30,
179+
),
180+
),
181+
("manually_created", models.BooleanField(default=False)),
182+
(
183+
"classifier",
184+
models.ForeignKey(
185+
null=True,
186+
on_delete=django.db.models.deletion.CASCADE,
187+
to=settings.AUTH_USER_MODEL,
188+
),
189+
),
190+
(
191+
"related_summary",
192+
models.ForeignKey(
193+
null=True,
194+
on_delete=django.db.models.deletion.CASCADE,
195+
related_name="related_alerts",
196+
to="perf.performancealertsummarytesting",
197+
),
198+
),
199+
(
200+
"series_signature",
201+
models.ForeignKey(
202+
on_delete=django.db.models.deletion.CASCADE,
203+
to="perf.performancesignature",
204+
),
205+
),
206+
(
207+
"summary",
208+
models.ForeignKey(
209+
on_delete=django.db.models.deletion.CASCADE,
210+
related_name="alerts",
211+
to="perf.performancealertsummarytesting",
212+
),
213+
),
214+
],
215+
options={
216+
"db_table": "performance_alert_testing",
217+
"unique_together": {("summary", "series_signature")},
218+
},
219+
),
220+
]
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Generated by Django 4.2.16 on 2024-09-18 16:56
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("perf", "0053_performancealertsummarytesting_and_more"),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name="performancealert",
15+
name="confidence",
16+
field=models.FloatField(
17+
help_text="A value that indicates the confidence of the alert (specific to the detection method used)",
18+
null=True,
19+
),
20+
),
21+
migrations.AddField(
22+
model_name="performancealert",
23+
name="detection_method",
24+
field=models.CharField(max_length=100, null=True),
25+
),
26+
migrations.AddField(
27+
model_name="performancealerttesting",
28+
name="confidence",
29+
field=models.FloatField(
30+
help_text="A value that indicates the confidence of the alert (specific to the detection method used)",
31+
null=True,
32+
),
33+
),
34+
migrations.AddField(
35+
model_name="performancealerttesting",
36+
name="detection_method",
37+
field=models.CharField(max_length=100, null=True),
38+
),
39+
]

0 commit comments

Comments
 (0)