yandex-tank/Tank/Plugins/report.tpl

23 lines
5.0 KiB
Smarty
Raw Normal View History

<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script type="text/javascript">
2014-03-19 11:05:50 +00:00
(function(){var n,e,t,a,i,r,o=[].indexOf||function(n){for(var e=0,t=this.length;t>e;e++)if(e in this&&this[e]===n)return e;return-1};e={colors:["#2f7ed8","#0d233a","#8bbc21","#910000","#1aadce","#492970","#f28f43","#77a1e5","#c42525","#a6c96a"]},a=["#49006a","#7a0177","#ae017e","#dd3497","#f768a1","#fa9fb5","#fcc5c0","#fde0dd","#fff7f3","#ffffff"],i=["quantiles","CPU","http_codes","net_codes","Memory","avg"],t={spline:{lineWidth:2,states:{hover:{lineWidth:4}},marker:{enabled:!1}}},r={area:{lineWidth:0,stacking:"normal",marker:{enabled:!1}}},function(n,e){var t,a;n&&(t=n.Chart.prototype,a=n.Legend.prototype,n.extend(t,{legendSetVisibility:function(n){var i,r,o,s,l,c,d,h;if(i=this,o=i.legend,c=void 0,s=void 0,l=void 0,d=i.options.legend,h=void 0,r=void 0,d.enabled!==n){if(d.enabled=n,!n){if(a.destroy.call(o),c=o.allItems)for(s=0,l=c.length;l>s;)c[s].legendItem=e,++s;o.group={}}t.render.call(i),d.floating||(h=i.scroller,h&&h.render&&(r=i.xAxis[0].getExtremes(),h.render(r.min,r.max)))}},legendHide:function(){this.legendSetVisibility(!1)},legendShow:function(){this.legendSetVisibility(!0)},legendToggle:function(){this.legendSetVisibility(this.options.legend.enabled^!0)}}))}(Highcharts),n=function(){function n(n,e,t){var a,i,r=this;this.name=e,this.data=t,a=$(" <button class='btn'> <span class='glyphicon glyphicon-list' /> </button> "),a.click(function(){return r.chart?r.chart.legendToggle():void 0}),this.container=$("<div />",{title:this.name}),i=$("<div />"),a.appendTo(i),this.container.appendTo(i),i.appendTo(n),this.params=$(n).data()}return n.prototype._update=function(){var n,s,l;return this.chart=new Highcharts.Chart({title:{text:this.name,x:-20},xAxis:{title:{text:"Time"},type:"datetime"},yAxis:{title:{text:"Value"},plotLines:[{value:0,width:1,color:"#808080"}]},tooltip:{crosshairs:!0},chart:{type:(n=this.name,o.call(i,n)>=0?"area":"spline"),zoomType:"xy",renderTo:$(this.container)[0]},plotOptions:(s=this.name,o.call(i,s)>=0?r:t),colors:(l=this.name,o.call(i,l)>=0?a:e),legend:{layout:"horizontal",align:"center",verticalAlign:"bottom",borderWidth:0},series:this.data})},n}(),$(document).ready(function(){return $(".tank-charts").each(function(){var e,t,a,i,r,o,s,l,c,d,h,u;a=$('<div class="panel panel-default">\n <div class="panel-heading">\n <h3>Overall tank metrics</h3>\n </div>\n <div class="panel-body charts-container" />\n</div>'),a.appendTo(this),d=document.tank_metrics.overall;for(s in d)r=d[s],i=function(){var n;n=[];for(o in r)c=r[o],n.push({name:o,data:function(){var n,e,t;for(t=[],n=0,e=c.length;e>n;n++)l=c[n],t.push([1e3*l[0],l[1]]);return t}()});return n}().sort(function(n,e){return"quantiles"===s?parseFloat(n.name)<=parseFloat(e.name)?1:-1:n.name>=e.name?1:-1}),new n(a.find(".charts-container"),s,i)._update();h=document.tank_metrics.cases,u=[];for(t in h)e=h[t],a=$('<div class="panel panel-default">\n <div class="panel-heading">\n <h3>Metrics for \''+t+'\' case</h3>\n </div>\n <div class="panel-body charts-container" />\n</div>'),a.appendTo(this),u.push(function(){var t;t=[];for(s in e)r=e[s],i=function(){var n;n=[];for(o in r)c=r[o],n.push({name:o,data:function(){var n,e,t;for(t=[],n=0,e=c.length;e>n;n++)l=c[n],t.push([1e3*l[0],l[1]]);return t}()});return n}().sort(function(n,e){return"quantiles"===s?parseFloat(n.name)<=parseFloat(e.name)?1:-1:n.name>=e.name?1:-1}),t.push(new n(a.find(".charts-container"),s,i)._update());return t}());return u}),$(".monitoring-charts").each(function(){var e,t,a,i,r,o,s,l,c,d,h;d=document.tank_metrics.monitoring,h=[];for(i in d)r=d[i],e=$('<div class="panel panel-default">\n <div class="panel-heading">\n <h3>Metrics for '+i+'</h3>\n </div>\n <div class="panel-body charts-container" />\n</div>'),e.appendTo(this),h.push(function(){var i;i=[];for(s in r)a=r[s],t=function(){var n;n=[];for(o in a)c=a[o],n.push({name:o,data:function(){var n,e,t;for(t=[],n=0,e=c.length;e>n;n++)l=c[n],t.push([1e3*l[0],l[1]]);return t}()});return n}().sort(function(n,e){return"quantiles"===s?parseFloat(n.name)<=parseFloat(e.name)?1:-1:n.name>=e.name?1:-1}),i.pu
</script>
<script type="text/javascript">
document.tank_metrics = $metrics
</script>
</head>
<body>
2014-03-03 14:17:22 +00:00
<div class="container">
<h2> Tank metrics </h2>
<div class="tank-charts"> </div>
<h2> Monitoring metrics </h2>
<div class="monitoring-charts"> </div>
</div>
<body>
<html>