Commit a5d60986 by Johannes Stelzer

Added threads view

parent 6ff2b45c
......@@ -76,7 +76,12 @@ angular.module('springBootAdmin', [
url: '/jmx',
templateUrl: 'views/apps/jmx.html',
controller: 'jmxCtrl'
});
})
.state('apps.threads', {
url: '/threads',
templateUrl: 'views/apps/threads.html',
controller: 'threadsCtrl'
});
})
.run(function ($rootScope, $state, $stateParams, $log) {
$rootScope.$state = $state;
......
......@@ -389,4 +389,25 @@ angular.module('springBootAdmin')
}
}
}
}])
.controller('threadsCtrl', ['$scope', '$stateParams', 'Application', 'ApplicationThreads',
function ($scope, $stateParams, Application, ApplicationThreads) {
$scope.application = Application.query({id: $stateParams.id});
$scope.dumpThreads = function() {
ApplicationThreads.getDump($scope.application).success(function(dump) {
$scope.dump = dump;
var threadStats = { NEW: 0, RUNNABLE: 0, BLOCKED: 0, WAITING: 0, TIMED_WAITING: 0, TERMINATED: 0};
for (var i = 0; i < dump.length; i++) {
threadStats[dump[i].threadState]++;
}
threadStats.total = dump.length;
$scope.threadStats = threadStats;
}).error( function(error) {
$scope.error = error;
});
}
}]);
......@@ -328,4 +328,9 @@ angular.module('springBootAdmin.services', ['ngResource'])
}
}
}
}])
.service('ApplicationThreads', ['$http', function($http) {
this.getDump = function(app) {
return $http.get(app.url + '/dump');
}
}]);
......@@ -30,6 +30,10 @@ a:active {
color: #5fa134;
}
pre {
white-space: pre;
}
/** NVD3 **/
.nvd3 text, div.nvtooltip {
font-size: 14px;
......
......@@ -3,6 +3,7 @@
<a class="btn " ng-class="{active: $state.includes('apps.details')}" ui-sref="apps.details.metrics({id: applicationId})">Details</a>
<a class="btn " ui-sref-active="active" ui-sref="apps.logging({id: applicationId})" >Logging</a></label>
<a class="btn " ui-sref-active="active" ui-sref="apps.jmx({id: applicationId})">JMX</a></label>
<a class="btn " ui-sref-active="active" ui-sref="apps.threads({id: applicationId})">Threads</a></label>
</div>
</h2>
<div ui-view></div>
<div class="alert alert-error" ng-if="error">
<b>Error:</b> {{ error }}
</div>
<div class="container">
<div class="row">
<div class="span12 text-center" >
<form>
<button class="btn" ng-click="dumpThreads()"><i class="icon-screenshot"></i> Dump all threads!</button>
</form>
</div>
</div>
<div class="row" ng-show="threadStats" >
<div class="span12">
<div class="progress">
<div ng-if="threadStats.NEW &gt; 0" class="bar bar-info" style="width:{{ threadStats.NEW / threadStats.total * 100 | number:0 }}%;">
New {{ threadStats.NEW }}
</div>
<div ng-if="threadStats.RUNNABLE &gt; 0" class="bar bar-success" style="width:{{ threadStats.RUNNABLE / threadStats.total * 100 | number:0 }}%;">
Runnable {{ threadStats.RUNNABLE }}
</div>
<div ng-if="threadStats.BLOCKED &gt; 0" class="bar bar-danger" style="width:{{ threadStats.BLOCKED / threadStats.total * 100 | number:0 }}%;">
Blocked {{ threadStats.BLOCKED }}
</div>
<div ng-if="threadStats.WAITING &gt; 0" class="bar bar-warning" style="width:{{ threadStats.WAITING / threadStats.total * 100 | number:0 }}%;">
Waiting {{ threadStats.WAITING }}
</div>
<div ng-if="threadStats.TIMED_WAITING &gt; 0" class="bar bar-warning bar-striped" style="width:{{ threadStats.TIMED_WAITING / threadStats.total * 100 | number:0 }}%;">
Timed waiting {{ threadStats.TIMED_WAITING }}
</div>
<div ng-if="threadStats.TERMINATED &gt; 0" class="bar bar-info" style="width:{{ threadStats.TERMINATED / threadStats.total * 100 | number:0 }}%;">
Terminated {{ threadStats.TERMINATED }}
</div>
</div>
</div>
</div>
<div class="row" ng-show="dump">
<div class="span12">
<accordion close-others="true">
<accordion-group ng-repeat="thread in dump | orderBy:'threadName' track by thread.threadId">
<accordion-heading>
<small class="muted">{{thread.threadId}}</small>
{{thread.threadName}}
<span class="pull-right label" ng-class="{ 'label-info': thread.threadState == 'NEW', 'label-success': thread.threadState == 'RUNNABLE', 'label-important': thread.threadState == 'BLOCKED', 'label-warning': thread.threadState == 'TIMED_WAITING' || thread.threadState == 'WAITING', 'label-info': thread.threadState == 'TERMINATED'}">{{thread.threadState}}</span> <span class="label label-warning" ng-if="thread.suspended">suspended</span>
</accordion-heading>
<div class="container">
<div class="row" >
<table class="span6">
<colgroup>
<col style="min-width: 10em;"/>
</colgroup>
<tr><td>Blocked count</td><td>{{thread.blockedCount}}</td></tr>
<tr><td>Blocked time</td><td>{{thread.blockedTime}}</td></tr>
<tr><td>Waited count</td><td>{{thread.waitedCount}}</td></tr>
<tr><td>Waited time</td><td>{{thread.waitedTime}}</td></tr>
</table>
<table class="span6">
<colgroup>
<col style="min-width: 10em;"/>
</colgroup>
<tr><td>Lock name</td><td>{{thread.lockName}}</td></tr>
<tr><td>Lock owner id</td><td>{{thread.lockOwnerId}}</td></tr>
<tr><td>Lock owner name</td><td>{{thread.lockOwnerName}}</td></tr>
</table>
</div>
</div>
<pre style="overflow: auto; max-height: 20em" ng-if="thread.stackTrace"><span ng-repeat="el in thread.stackTrace">{{el.className}}.{{el.methodName}}({{el.fileName}}:{{el.lineNumber}}) <span class="label" ng-if="el.nativeMethod">native</span>
</span></pre>
</accordion-group>
</accordion>
</div>
</div>
</div>
\ No newline at end of file
......@@ -3,10 +3,6 @@
</h2>
<div class="span12">
<table class="table table-striped">
<colgroup style="width: 40%;"/>
<colgroup style="width: 15%;"/>
<colgroup style="width: 10%;"/>
<colgroup style="width: 35%;"/>
<thead>
<tr>
<th>Application</th>
......@@ -26,8 +22,9 @@
<a ui-sref="apps.details.metrics({id: application.id})" class="btn btn-success">Details</a>
<a ui-sref="apps.logging({id: application.id})" class="btn btn-success">Logging</a>
<a ui-sref="apps.jmx({id: application.id})" class="btn btn-success">JMX</a>
<a ui-sref="apps.threads({id: application.id})" class="btn btn-success">Threads</a>
</span>
<span class="pull-right" ng-show="application.status == null || application.status != 'UP'">
<span class="pull-right" ng-show="application.status == null || application.status == 'OFFLINE'">
<a class="btn btn-danger" ng-click="remove(application)"><i class="icon-remove icon-white"></i>Remove</a>
</span>
</td>
......
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