File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed
Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change 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 >
You can’t perform that action at this time.
0 commit comments