Skip to content

Commit 9737fe9

Browse files
committed
deploy: 6c11faa
1 parent 741c129 commit 9737fe9

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

metrics/index.html

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<html>
2+
3+
<head>
4+
<script src="https://cdn.plot.ly/plotly-2.9.0.min.js"></script>
5+
<script src="https://d3js.org/d3.v4.min.js">
6+
</script>
7+
</head>
8+
9+
<body>
10+
<div id="plots"></div>
11+
<script>
12+
async function populate() {
13+
let response = await fetch("https://cloud-hypervisor-metrics.azurewebsites.net/api/getmetricsnames");
14+
15+
if (response.ok) {
16+
let metrics = await response.json();
17+
let plots_div = document.getElementById("plots");
18+
19+
for (let i in metrics) {
20+
let metric_name = metrics[i];
21+
let plot_div = document.createElement("div");
22+
plot_div.id = "plot_" + metric_name;
23+
plots_div.appendChild(plot_div);
24+
25+
d3.json(`https://cloud-hypervisor-metrics.azurewebsites.net/api/getmetrics?metric_name=${metric_name}`, function (err, rows) {
26+
function unpack(rows, key) {
27+
return rows.map(function (row) { return row[key]; });
28+
}
29+
30+
let trace = {
31+
type: "scatter",
32+
name: "mean",
33+
x: unpack(rows, 'git_commit_date_sortable'),
34+
y: unpack(rows, 'mean'),
35+
text: unpack(rows, "git_revision")
36+
}
37+
38+
let data = [trace];
39+
let layout = {
40+
title: metric_name,
41+
};
42+
43+
Plotly.newPlot('plot_' + metric_name, data, layout);
44+
})
45+
}
46+
}
47+
}
48+
49+
populate();
50+
</script>
51+
</body>
52+
53+
</html>

0 commit comments

Comments
 (0)