Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Commit 4167e27

Browse files
clsullivalexjch
authored andcommitted
mce: add bar chart sorting MCEs by status code
Knowing what issues are most common is a useful statistic. Signed-off-by: California Sullivan <[email protected]>
1 parent 5fc1e49 commit 4167e27

File tree

3 files changed

+68
-4
lines changed

3 files changed

+68
-4
lines changed

telemetryui/telemetryui/static/js/mce.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,55 @@
140140
rootObj.newChart(ctx, "bar", data, options);
141141
}
142142

143+
function renderMCEStatus(ctx, labels, values){
144+
145+
var data = {
146+
labels: labels,
147+
datasets:[
148+
{
149+
label: "MCE counts by status",
150+
data: values
151+
}
152+
]
153+
};
154+
155+
var options = {
156+
legend: { display: false },
157+
title: {
158+
display: true,
159+
text: "MCE reports by status",
160+
fontSize: 18
161+
},
162+
scales: {
163+
yAxes: [{
164+
scaleLabel: {
165+
display: true,
166+
labelString: "MCE count",
167+
fontSize: 15,
168+
fontStyle: "italic"
169+
},
170+
ticks: {
171+
beginAtZero: true
172+
}
173+
}],
174+
xAxes: [{
175+
scaleLabel: {
176+
display: true,
177+
labelString: "Last 32 bits of status code",
178+
fontSize: 15,
179+
fontStyle: "italic"
180+
},
181+
barThickness: 15
182+
}]
183+
}
184+
};
185+
186+
rootObj.newChart(ctx, "bar", data, options);
187+
}
188+
143189
rootObj.renderMCEClass = renderMCEClass;
144190
rootObj.renderMCEReports = renderMCEReports;
191+
rootObj.renderMCEStatus = renderMCEStatus;
145192
rootObj.parseMCEChartData = parseMCEChartData;
146193
rootObj.renderOneChart = renderOneChart;
147194
});

telemetryui/telemetryui/templates/mce.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,13 @@ <h2>Top MCE</h2>
9696
</table>
9797
</div>
9898
<div class="col-md-6" style="min-height: 500px;">
99-
<canvas id="pie-classification" width="450" height="450"></canvas>
99+
<canvas id="bar-reports-by-status" width="450" height="450"></canvas>
100100
</div>
101101
<div class="col-md-6" style="min-height: 500px;">
102-
<canvas id="bar-reports" width="450" height="450"></canvas>
102+
<canvas id="bar-reports-by-build" width="450" height="450"></canvas>
103+
</div>
104+
<div class="col-md-6" style="min-height: 500px;">
105+
<canvas id="pie-classification" width="450" height="450"></canvas>
103106
</div>
104107

105108
</div>
@@ -136,10 +139,15 @@ <h2>Top MCE</h2>
136139
[{% for s in charts[0].record_stats %} "{{ s[1] }}", {% endfor %}]);
137140
138141
telemetryUI.renderMCEReports(
139-
document.getElementById("bar-reports").getContext("2d"),
142+
document.getElementById("bar-reports-by-build").getContext("2d"),
140143
[{% for s in charts[1].record_stats %} "{{ s[0] }}", {% endfor %}],
141144
[{% for s in charts[1].record_stats %} "{{ s[1] }}", {% endfor %}]);
142145
146+
telemetryUI.renderMCEStatus(
147+
document.getElementById("bar-reports-by-status").getContext("2d"),
148+
[{% for s in charts[2].record_stats %} "{{ s[0] }}", {% endfor %}],
149+
[{% for s in charts[2].record_stats %} "{{ s[1] }}", {% endfor %}]);
150+
143151
var fullmce = {{ fullmce|safe }};
144152
for (clas in fullmce){
145153
telemetryUI.renderOneChart(document.getElementById("fullmce-chart-"+clas).getContext("2d"), telemetryUI.parseMCEChartData(clas, fullmce[clas]));

telemetryui/telemetryui/views.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ def mce():
469469
maxcnt = 0
470470
by_machine_id = {}
471471
by_builds = {}
472+
by_mce_status = {}
472473
week_rec_map = {}
473474
class_rec_map = {}
474475
for record in records:
@@ -483,6 +484,13 @@ def mce():
483484
by_machine_id[record.machine_id]["recordscnt"] += 1
484485
by_builds.setdefault(record.build, 0)
485486
by_builds[record.build] += 1
487+
status_match = re.search('STATUS.*([A-Fa-f0-9]{8}) MCGSTATUS', record.payload)
488+
if status_match:
489+
status = status_match.group(1)
490+
if status in by_mce_status:
491+
by_mce_status[status] += 1
492+
else:
493+
by_mce_status[status] = 1
486494
for machine_id in list(by_machine_id.keys()):
487495
builds_cnt = by_machine_id[machine_id]["builds"]
488496
maxcnt = max(list(builds_cnt.values()) + [maxcnt])
@@ -493,7 +501,8 @@ def mce():
493501
})
494502
top10.sort(key=lambda x: x["recordscnt"], reverse=True)
495503
charts = [{'column': 'classification', 'record_stats': class_rec_map.items(), 'type': 'pie', 'width': 6},
496-
{'column': 'build', 'record_stats': sorted(by_builds.items(), key=lambda x: x[0]), 'type': 'column', 'width': 6}]
504+
{'column': 'build', 'record_stats': sorted(by_builds.items(), key=lambda x: x[0]), 'type': 'column', 'width': 6},
505+
{'column': 'status', 'record_stats': sorted(by_mce_status.items(), key=lambda x: x[0]), 'type': 'column', 'width': 6}]
497506
return render_template('mce.html', charts=charts, top10=top10, builds=sorted(by_builds.keys()), maxcnt=maxcnt, fullmce=week_rec_map)
498507

499508

0 commit comments

Comments
 (0)