blob: 97a8576f762f4453aa70ed81f768c90229f1f343 [file] [log] [blame]
ramangrover29a04696c2013-07-31 21:50:38 -07001<html>
2 <head>
ramangrover2975b73552013-08-06 10:31:04 -07003 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
ramangrover29a04696c2013-07-31 21:50:38 -07004 <script type="text/javascript" src="/webui/static/js/smoothie.js"></script>
ramangrover29a04696c2013-07-31 21:50:38 -07005 <script type="text/javascript">
ramangrover2975b73552013-08-06 10:31:04 -07006 $(document).ready(function() {
7 var feedSeries = new TimeSeries();
ramangrover2920afdc32013-08-07 17:18:53 -07008
9 var dataverse = "%s";
10 var dataset = "%s";
11 var feed = "%s";
12 var ingestLocations = "%s";
13 var computeLocations = "%s";
14 var storageLocations = "%s";
15 var ingestionPolicy = "%s";
16 var activeSince = "%s";
17 var targetUrl = "/feed/data?dataverse=" + dataverse + "&dataset=" + dataset + "&feed=" + feed;
ramangrover29a04696c2013-07-31 21:50:38 -070018
ramangrover2920afdc32013-08-07 17:18:53 -070019
20 var ingestionNodes = ingestLocations.split(",");
21 var numIngestionNodes = ingestionNodes.length;
22 var seriesOptions = { strokeStyle: 'rgba(0, 255, 0, 1)', fillStyle: 'rgba(0, 255, 0, 0.2)', lineWidth: 4 };
23 var ingestionTimeSeries = new Array();
24 var graphNames = new Array();
25
26 $.ajaxSetup({ cache: false });
27 setInterval(fetchFeedReport, 500);
ramangrover2975b73552013-08-06 10:31:04 -070028 function fetchFeedReport() {
29 $.ajax({
ramangrover2920afdc32013-08-07 17:18:53 -070030 url: '/feed/data?dataverse=' + dataverse + '&dataset=' + dataset + '&feed=' + feed,
ramangrover2975b73552013-08-06 10:31:04 -070031 method: 'GET',
32 dataType: 'json',
33 success: onFeedReportReceived
34 });
35 }
ramangrover2940636ee2013-08-04 22:05:49 -070036
ramangrover2975b73552013-08-06 10:31:04 -070037
38 function onFeedReportReceived(data) {
ramangrover292d3f6dd2013-08-14 17:14:27 -070039 var type = data["type"];
40 if (type == ("reload")) {
41 ingestLocations = data["ingestLocations"];
42 computeLocations = data["computeLocations"];
43 storageLocations = data["storageLocations"];
44 document.location.reload(true);
45 } else {
ramangrover2920afdc32013-08-07 17:18:53 -070046 var report = data["value"];
47 var tputArray = report.split("|");
48 var covered = 0;
49 var totalTput = 0;
ramangrover29ff745502013-08-09 17:20:26 -070050 for( var i = 0; i < tputArray.length-1; i ++){
ramangrover2920afdc32013-08-07 17:18:53 -070051 ingestionTimeSeries[i].append(data["time"], tputArray[i]);
52 covered++;
53 totalTput += parseInt(tputArray[i]);
54 }
55 for( var j = covered; j < numIngestionNodes; j++){
56 ingestionTimeSeries[j].append(data["time"], 0);
57 }
58 ingestionTimeSeries[numIngestionNodes].append(data["time"], totalTput);
ramangrover292d3f6dd2013-08-14 17:14:27 -070059 }
ramangrover2975b73552013-08-06 10:31:04 -070060 }
61
62 function myYRangeFunction(range) {
63 var min = 0;
64 var max = 5000;
65 return {min: min, max: max};
66 }
67
ramangrover2920afdc32013-08-07 17:18:53 -070068 function initTimeline(ingestLocations) {
ramangrover2975b73552013-08-06 10:31:04 -070069
ramangrover29206f4072013-08-15 14:24:31 -070070 document.write("<i>" + "Feed Ingestion" + " " + "<i>");
71 document.write("<br />" + "Ingestion Locations: " + ingestLocations);
ramangrover2920afdc32013-08-07 17:18:53 -070072 document.write("<br />" + "Compute Locations: " + computeLocations);
73 document.write("<br />" + "Storage Locations: " + storageLocations);
74 document.write("<br />" + "Ingestion Policy: " + ingestionPolicy);
75 document.write("<br />" + "Active since" + activeSince);
76 document.write("<br />");
77 document.write("<br />");
78
79 for( var i = 0; i < numIngestionNodes; i++){
ramangrover292d3f6dd2013-08-14 17:14:27 -070080 graphNames[i] = "Partition " + i;
ramangrover2920afdc32013-08-07 17:18:53 -070081 }
82
83 if(numIngestionNodes > 1){
84 graphNames[numIngestionNodes] = "IngestionThroughput";
85 drawCanvas(graphNames[numIngestionNodes]);
86 ingestionTimeSeries[numIngestionNodes] = new TimeSeries();
87 drawChart(graphNames[numIngestionNodes], ingestionTimeSeries[numIngestionNodes]);
88 }
89
90 for( var j = 0; j < numIngestionNodes; j++){
91 drawCanvas(graphNames[j]);
92 ingestionTimeSeries[j] = new TimeSeries();
93 drawChart(graphNames[j], ingestionTimeSeries[j]);
94 }
ramangrover2975b73552013-08-06 10:31:04 -070095 }
ramangrover2920afdc32013-08-07 17:18:53 -070096
97 function drawCanvas(chartName) {
98 document.write("<br />");
99 document.write("<br />");
100 document.write("<i>" + chartName + "</i>");
101 document.write("<br />");
102 document.write("<canvas id="+ "\"" + chartName + "\"" + " " + "width=\"500\" height=\"250\"></canvas>");
103 }
104
105 function drawChart(chartName, ingestionTimeSeries) {
ramangrover29206f4072013-08-15 14:24:31 -0700106 var ingestionChart = new SmoothieChart({ minValue:0, millisPerPixel: 20, grid: { strokeStyle: '#555555', lineWidth: 1, millisPerLine: 1000, verticalSections: 10 }});
ramangrover2920afdc32013-08-07 17:18:53 -0700107 ingestionChart.addTimeSeries(ingestionTimeSeries, seriesOptions);
108 ingestionChart.streamTo(document.getElementById(chartName, 500));
109 }
110
111 initTimeline(ingestLocations);
ramangrover2975b73552013-08-06 10:31:04 -0700112 });
ramangrover29a04696c2013-07-31 21:50:38 -0700113 </script>
ramangrover29c996e282013-08-03 14:36:45 -0700114 </head>
ramangrover2920afdc32013-08-07 17:18:53 -0700115 <body></body>
ramangrover29a04696c2013-07-31 21:50:38 -0700116</html>
ramangrover2975b73552013-08-06 10:31:04 -0700117