1
0
mirror of https://github.com/ohwgiles/laminar.git synced 2026-03-02 03:40:21 +00:00

move buildTimeDist chart to examples

too esoteric for the front page, converting it to an example
of querying laminar db directly and using gnuplot should provide
more value to those needing deeper insights into job behaviour.
This commit is contained in:
Oliver Giles
2020-09-26 15:12:02 +12:00
parent 9862affd98
commit 746ab24676
5 changed files with 46 additions and 39 deletions

View File

@@ -458,29 +458,6 @@ std::string Laminar::getStatus(MonitorScope scope) {
j.EndObject();
});
j.EndArray();
j.startArray("buildTimeDist");
db->stmt("WITH ba AS (SELECT name,AVG(completedAt-startedAt) a FROM builds GROUP BY name) SELECT "
"COUNT(CASE WHEN a < 30 THEN 1 END),"
"COUNT(CASE WHEN a >= 30 AND a < 60 THEN 1 END),"
"COUNT(CASE WHEN a >= 60 AND a < 300 THEN 1 END),"
"COUNT(CASE WHEN a >= 300 AND a < 600 THEN 1 END),"
"COUNT(CASE WHEN a >= 600 AND a < 1200 THEN 1 END),"
"COUNT(CASE WHEN a >= 1200 AND a < 2400 THEN 1 END),"
"COUNT(CASE WHEN a >= 2400 AND a < 3600 THEN 1 END),"
"COUNT(CASE WHEN a >= 3600 THEN 1 END) FROM ba")
.fetch<uint,uint,uint,uint,uint,uint,uint,uint>([&](uint c1, uint c2, uint c3, uint c4, uint c5, uint c6, uint c7, uint c8){
j.Int(c1);
j.Int(c2);
j.Int(c3);
j.Int(c4);
j.Int(c5);
j.Int(c6);
j.Int(c7);
j.Int(c8);
});
j.EndArray();
}
j.EndObject();
return j.str();

View File

@@ -71,7 +71,6 @@
<div><canvas id="chartBpj"></canvas></div>
<div><canvas id="chartTpj"></canvas></div>
<div><canvas id="chartBuildTimeChanges"></canvas></div>
<div><canvas id="chartBuildTimeDist"></canvas></div>
</div>
</section>
</div></template>

View File

@@ -350,20 +350,6 @@ const Home = function() {
}
}
});
var chtBuildTimeDist = new Chart(document.getElementById("chartBuildTimeDist"), {
type: 'line',
data: {
labels: ['<30s','30s-1m','1m-5m','5m-10m','10m-20m','20m-40m','40m-60m','>60m'],
datasets: [{
label: 'Number jobs with average build time in range',
data: msg.buildTimeDist,
backgroundColor: "#7483af",
}]
},
options: {
title: { display: true, text: 'Build time distribution' }
}
});
},
job_queued: function(data) {
state.jobsQueued.splice(0, 0, data);