Skip to content

Commit e054e8f

Browse files
author
Johannes Stelzer
committed
Added view for traces-endpoint
closes #35
1 parent d8395c2 commit e054e8f

File tree

8 files changed

+185
-1
lines changed

8 files changed

+185
-1
lines changed

spring-boot-admin-server-ui/app/css/main.css

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,3 +267,77 @@ span.refresh {
267267
background-image: linear-gradient(to bottom, #ee5f5b, #c43c35);
268268
background-repeat: repeat-x;
269269
}
270+
271+
/** Timeline **/
272+
.timeline {
273+
position: relative;
274+
padding: 1em 0;
275+
list-style-type: none;
276+
padding-left: 120px;
277+
}
278+
279+
.timeline:before {
280+
position: absolute;
281+
top: 0;
282+
content: ' ';
283+
display: block;
284+
width: 6px;
285+
height: 100%;
286+
margin-left: 0px;
287+
background: rgb(80,80,80);
288+
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%);
289+
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%);
290+
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%);
291+
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%);
292+
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%);
293+
z-index: 5;
294+
}
295+
296+
.timeline li {
297+
padding: 1em 0;
298+
}
299+
300+
.timeline li:after {
301+
content: "";
302+
display: block;
303+
height: 0;
304+
clear: both;
305+
visibility: hidden;
306+
}
307+
308+
.timeline .event {
309+
position: relative;
310+
width: 100%;
311+
display: inline-block;
312+
left: 15px;
313+
padding-left: 5px;
314+
cursor:pointer;
315+
}
316+
317+
.timeline .event .time {
318+
position: absolute;
319+
left: -120px;
320+
margin-left: -25px;
321+
display: inline-block;
322+
vertical-align: middle;
323+
text-align:right;
324+
width: 120px;
325+
}
326+
327+
.timeline .event:before {
328+
content: ' ';
329+
display: block;
330+
width: 12px;
331+
height: 12px;
332+
background: #fff;
333+
border-radius: 10px;
334+
border: 4px solid #6db33f;
335+
z-index: 10;
336+
position: absolute;
337+
left: -6px;
338+
margin-left: -15px;
339+
}
340+
341+
.timeline .event:hover:before {
342+
background: #ccc;
343+
}

spring-boot-admin-server-ui/app/js/app.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ springBootAdmin.config(function ($stateProvider, $urlRouterProvider) {
107107
url: '/threads',
108108
templateUrl: 'views/apps/threads.html',
109109
controller: 'threadsCtrl'
110+
})
111+
.state('apps.trace', {
112+
url: '/trace',
113+
templateUrl: 'views/apps/trace.html',
114+
controller: 'traceCtrl'
110115
});
111116
});
112117
springBootAdmin.run(function ($rootScope, $state) {

spring-boot-admin-server-ui/app/js/controller/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ springBootAdmin.controller('detailsClasspathCtrl', require('./detailsClasspathCt
1313
springBootAdmin.controller('loggingCtrl', require('./loggingCtrl'));
1414
springBootAdmin.controller('jmxCtrl', require('./jmxCtrl'));
1515
springBootAdmin.controller('threadsCtrl', require('./threadsCtrl'));
16+
springBootAdmin.controller('traceCtrl', require('./traceCtrl'));
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright 2014 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
'use strict';
17+
18+
module.exports = function ($scope, application, ApplicationTrace, $interval) {
19+
$scope.lastTraceTime = 0;
20+
$scope.traces = [];
21+
$scope.refresher = null;
22+
$scope.refreshInterval = 5;
23+
24+
$scope.refresh = function () {
25+
ApplicationTrace.getTraces(application)
26+
.success(function (traces) {
27+
for (var i = 0; i < traces.length; i++) {
28+
if (traces[i].timestamp > $scope.lastTraceTime) {
29+
$scope.traces.push(traces[i]);
30+
}
31+
}
32+
if (traces.length > 0) {
33+
$scope.lastTraceTime = traces[traces.length - 1].timestamp;
34+
}
35+
36+
})
37+
.error(function (error) {
38+
$scope.error = error;
39+
});
40+
};
41+
42+
$scope.toggleAutoRefresh = function() {
43+
if ($scope.refresher === null) {
44+
$scope.refresher = $interval(function () {
45+
$scope.refresh();
46+
}, $scope.refreshInterval * 1000);
47+
} else {
48+
$interval.cancel($scope.refresher);
49+
$scope.refresher = null;
50+
}
51+
};
52+
53+
$scope.refresh();
54+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright 2014 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
'use strict';
17+
18+
module.exports = function ($http) {
19+
this.getTraces = function (app) {
20+
return $http.get(app.url + '/trace');
21+
};
22+
};

spring-boot-admin-server-ui/app/js/service/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ springBootAdmin.service('Abbreviator', require('./abbreviator'));
1414
springBootAdmin.service('jolokia', require('./jolokia'));
1515
springBootAdmin.service('MetricsHelper', require('./metricsHelper'));
1616
springBootAdmin.service('ApplicationThreads', require('./applicationThreads'));
17+
springBootAdmin.service('ApplicationTrace', require('./applicationTrace'));

spring-boot-admin-server-ui/app/views/apps.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ <h2 style="display: inline-block;">{{ application.name }}
1111
<a class="btn" ng-class="{active: $state.includes('apps.details')}" ui-sref="apps.details.metrics({id: application.id})">Details</a>
1212
<a class="btn" ui-sref-active="active" ui-sref="apps.logging({id: application.id})" >Logging</a></label>
1313
<a class="btn" ui-sref-active="active" ui-sref="apps.jmx({id: application.id})">JMX</a></label>
14-
<a class="btn" ui-sref-active="active" ui-sref="apps.threads({id: application.id})">Threads</a></label>
14+
<a class="btn" ui-sref-active="active" ui-sref="apps.threads({id: application.id})">Threads</a></label>
15+
<a class="btn" ui-sref-active="active" ui-sref="apps.trace({id: application.id})">Trace</a></label>
1516
</div>
1617
</div>
1718
</div>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<div class="alert alert-error" ng-if="error">
2+
<b>Error:</b> {{ error }}
3+
</div>
4+
<div class="container">
5+
<div class="form-inline">
6+
<button title="refresh" class="btn" ng-click="refresh()"><i class="icon-refresh"></i></button>
7+
<div class="input-prepend input-append">
8+
<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>
9+
<input class="input-mini" type="number" min="1" ng-model="refreshInterval" ng-disabled="refresher != null"></input>
10+
<span class="add-on">sec</span>
11+
</div>
12+
</div>
13+
<ul class="timeline">
14+
<li ng-repeat="trace in traces | orderBy:'timestamp':true" >
15+
<div class="event" ng-click="trace.show = !trace.show">
16+
<div class="time">
17+
{{trace.timestamp | date:'HH:mm:ss.sss'}}
18+
<small class="muted">{{trace.timestamp | date:'dd.MM.yyyy'}}</small><br/>
19+
</div>
20+
<div class="title"><span class="muted">{{trace.info.method}}</span> {{trace.info.path}}</div>
21+
<pre class="content" ng-show="trace.show">{{trace.info | json}}</pre>
22+
</div>
23+
</li>
24+
</ul>
25+
</div>
26+

0 commit comments

Comments
 (0)