Commit e054e8f3 by Johannes Stelzer

Added view for traces-endpoint

closes #35
parent d8395c20
......@@ -267,3 +267,77 @@ span.refresh {
background-image: linear-gradient(to bottom, #ee5f5b, #c43c35);
background-repeat: repeat-x;
}
/** Timeline **/
.timeline {
position: relative;
padding: 1em 0;
list-style-type: none;
padding-left: 120px;
}
.timeline:before {
position: absolute;
top: 0;
content: ' ';
display: block;
width: 6px;
height: 100%;
margin-left: 0px;
background: rgb(80,80,80);
background: -moz-linear-gradient(top, rgba(80,80,80,0) 0%, rgb(80,80,80) 8%, rgb(80,80,80) 92%, rgba(80,80,80,0) 100%);
background: -webkit-linear-gradient(top, rgba(80,80,80,0) 0%, rgb(80,80,80) 8%, rgb(80,80,80) 92%, rgba(80,80,80,0) 100%);
background: -o-linear-gradient(top, rgba(80,80,80,0) 0%, rgb(80,80,80) 8%, rgb(80,80,80) 92%, rgba(80,80,80,0) 100%);
background: -ms-linear-gradient(top, rgba(80,80,80,0) 0%, rgb(80,80,80) 8%, rgb(80,80,80) 92%, rgba(80,80,80,0) 100%);
background: linear-gradient(to bottom, rgba(80,80,80,0) 0%, rgb(80,80,80) 8%, rgb(80,80,80) 92%, rgba(80,80,80,0) 100%);
z-index: 5;
}
.timeline li {
padding: 1em 0;
}
.timeline li:after {
content: "";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.timeline .event {
position: relative;
width: 100%;
display: inline-block;
left: 15px;
padding-left: 5px;
cursor:pointer;
}
.timeline .event .time {
position: absolute;
left: -120px;
margin-left: -25px;
display: inline-block;
vertical-align: middle;
text-align:right;
width: 120px;
}
.timeline .event:before {
content: ' ';
display: block;
width: 12px;
height: 12px;
background: #fff;
border-radius: 10px;
border: 4px solid #6db33f;
z-index: 10;
position: absolute;
left: -6px;
margin-left: -15px;
}
.timeline .event:hover:before {
background: #ccc;
}
......@@ -107,6 +107,11 @@ springBootAdmin.config(function ($stateProvider, $urlRouterProvider) {
url: '/threads',
templateUrl: 'views/apps/threads.html',
controller: 'threadsCtrl'
})
.state('apps.trace', {
url: '/trace',
templateUrl: 'views/apps/trace.html',
controller: 'traceCtrl'
});
});
springBootAdmin.run(function ($rootScope, $state) {
......
......@@ -13,3 +13,4 @@ springBootAdmin.controller('detailsClasspathCtrl', require('./detailsClasspathCt
springBootAdmin.controller('loggingCtrl', require('./loggingCtrl'));
springBootAdmin.controller('jmxCtrl', require('./jmxCtrl'));
springBootAdmin.controller('threadsCtrl', require('./threadsCtrl'));
springBootAdmin.controller('traceCtrl', require('./traceCtrl'));
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
module.exports = function ($scope, application, ApplicationTrace, $interval) {
$scope.lastTraceTime = 0;
$scope.traces = [];
$scope.refresher = null;
$scope.refreshInterval = 5;
$scope.refresh = function () {
ApplicationTrace.getTraces(application)
.success(function (traces) {
for (var i = 0; i < traces.length; i++) {
if (traces[i].timestamp > $scope.lastTraceTime) {
$scope.traces.push(traces[i]);
}
}
if (traces.length > 0) {
$scope.lastTraceTime = traces[traces.length - 1].timestamp;
}
})
.error(function (error) {
$scope.error = error;
});
};
$scope.toggleAutoRefresh = function() {
if ($scope.refresher === null) {
$scope.refresher = $interval(function () {
$scope.refresh();
}, $scope.refreshInterval * 1000);
} else {
$interval.cancel($scope.refresher);
$scope.refresher = null;
}
};
$scope.refresh();
};
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
module.exports = function ($http) {
this.getTraces = function (app) {
return $http.get(app.url + '/trace');
};
};
......@@ -14,3 +14,4 @@ springBootAdmin.service('Abbreviator', require('./abbreviator'));
springBootAdmin.service('jolokia', require('./jolokia'));
springBootAdmin.service('MetricsHelper', require('./metricsHelper'));
springBootAdmin.service('ApplicationThreads', require('./applicationThreads'));
springBootAdmin.service('ApplicationTrace', require('./applicationTrace'));
......@@ -11,7 +11,8 @@
<a class="btn" ng-class="{active: $state.includes('apps.details')}" ui-sref="apps.details.metrics({id: application.id})">Details</a>
<a class="btn" ui-sref-active="active" ui-sref="apps.logging({id: application.id})" >Logging</a></label>
<a class="btn" ui-sref-active="active" ui-sref="apps.jmx({id: application.id})">JMX</a></label>
<a class="btn" ui-sref-active="active" ui-sref="apps.threads({id: application.id})">Threads</a></label>
<a class="btn" ui-sref-active="active" ui-sref="apps.threads({id: application.id})">Threads</a></label>
<a class="btn" ui-sref-active="active" ui-sref="apps.trace({id: application.id})">Trace</a></label>
</div>
</div>
</div>
......
<div class="alert alert-error" ng-if="error">
<b>Error:</b> {{ error }}
</div>
<div class="container">
<div class="form-inline">
<button title="refresh" class="btn" ng-click="refresh()"><i class="icon-refresh"></i></button>
<div class="input-prepend input-append">
<button title="auto refresh" class="btn" ng-click="toggleAutoRefresh()" ng-class="{'active':refresher != null}"><i ng-class="{'icon-play':refresher == null, 'icon-pause':refresher != null}"></i></button>
<input class="input-mini" type="number" min="1" ng-model="refreshInterval" ng-disabled="refresher != null"></input>
<span class="add-on">sec</span>
</div>
</div>
<ul class="timeline">
<li ng-repeat="trace in traces | orderBy:'timestamp':true" >
<div class="event" ng-click="trace.show = !trace.show">
<div class="time">
{{trace.timestamp | date:'HH:mm:ss.sss'}}
<small class="muted">{{trace.timestamp | date:'dd.MM.yyyy'}}</small><br/>
</div>
<div class="title"><span class="muted">{{trace.info.method}}</span> {{trace.info.path}}</div>
<pre class="content" ng-show="trace.show">{{trace.info | json}}</pre>
</div>
</li>
</ul>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment