Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-boot-admin
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-boot-admin
Commits
3a1499dd
Commit
3a1499dd
authored
Oct 29, 2014
by
Johannes Stelzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added datasource usage to details-view
parent
1595087e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
70 deletions
+69
-70
controllers.js
...src/main/webapp/public/scripts/controllers/controllers.js
+35
-67
services.js
...erver/src/main/webapp/public/scripts/services/services.js
+13
-0
details.html
...min-server/src/main/webapp/public/views/apps/details.html
+21
-3
No files found.
spring-boot-admin-server/src/main/webapp/public/scripts/controllers/controllers.js
View file @
3a1499dd
...
...
@@ -46,8 +46,8 @@ angular.module('springBootAdmin')
.
controller
(
'appsCtrl'
,
[
'$scope'
,
'$stateParams'
,
function
(
$scope
,
$stateParams
)
{
$scope
.
applicationId
=
$stateParams
.
id
;
}])
.
controller
(
'detailsCtrl'
,
[
'$scope'
,
'$stateParams'
,
'$interval'
,
'Application'
,
'ApplicationDetails'
,
function
(
$scope
,
$stateParams
,
$interval
,
Application
,
ApplicationDetails
)
{
.
controller
(
'detailsCtrl'
,
[
'$scope'
,
'$stateParams'
,
'$interval'
,
'Application'
,
'ApplicationDetails'
,
'MetricsHelper'
,
function
(
$scope
,
$stateParams
,
$interval
,
Application
,
ApplicationDetails
,
MetricsHelper
)
{
$scope
.
application
=
Application
.
query
({
id
:
$stateParams
.
id
},
function
(
application
)
{
ApplicationDetails
.
getInfo
(
application
);
...
...
@@ -55,23 +55,28 @@ angular.module('springBootAdmin')
application
.
metrics
[
"mem.used"
]
=
application
.
metrics
[
"mem"
]
-
$scope
.
application
.
metrics
[
"mem.free"
];
$scope
.
gcInfos
=
{};
for
(
var
metric
in
application
.
metrics
)
{
var
matchTime
=
/gc
\.(
.+
)\.
time/
.
exec
(
metric
);
if
(
matchTime
!==
null
)
{
var
gcName
=
matchTime
[
1
];
if
(
$scope
.
gcInfos
[
gcName
]
==
null
)
$scope
.
gcInfos
[
gcName
]
=
{};
$scope
.
gcInfos
[
gcName
].
time
=
application
.
metrics
[
metric
];
}
var
matchCount
=
/gc
\.(
.+
)\.
count/
.
exec
(
metric
);
if
(
matchCount
!==
null
)
{
var
gcName
=
matchCount
[
1
];
if
(
$scope
.
gcInfos
[
gcName
]
==
null
)
$scope
.
gcInfos
[
gcName
]
=
{};
$scope
.
gcInfos
[
gcName
].
count
=
application
.
metrics
[
metric
];
}
$scope
.
datasources
=
{}
function
createOrGet
(
map
,
key
,
factory
)
{
return
map
[
key
]
||
(
map
[
key
]
=
factory
());
}
MetricsHelper
.
find
(
application
.
metrics
,
[
/gc
\.(
.+
)\.
time/
,
/gc
\.(
.+
)\.
count/
,
/datasource
\.(
.+
)\.
active/
,
/datasource
\.(
.+
)\.
usage/
],
[
function
(
metric
,
match
,
value
)
{
createOrGet
(
$scope
.
gcInfos
,
match
[
1
],
function
()
{
return
{
time
:
0
,
count
:
0
};}).
time
=
value
;
},
function
(
metric
,
match
,
value
)
{
createOrGet
(
$scope
.
gcInfos
,
match
[
1
],
function
()
{
return
{
time
:
0
,
count
:
0
};}).
count
=
value
;
},
function
(
metric
,
match
,
value
)
{
$scope
.
hasDatasources
=
true
;
createOrGet
(
$scope
.
datasources
,
match
[
1
],
function
()
{
return
{
min
:
0
,
max
:
0
,
active
:
0
,
usage
:
0
};}).
active
=
value
;
},
function
(
metric
,
match
,
value
)
{
$scope
.
hasDatasources
=
true
;
createOrGet
(
$scope
.
datasources
,
match
[
1
],
function
()
{
return
{
min
:
0
,
max
:
0
,
active
:
0
,
usage
:
0
};}).
usage
=
value
;
}]);
});
});
...
...
@@ -80,8 +85,8 @@ angular.module('springBootAdmin')
$scope
.
ticks
=
Date
.
now
()
-
start
;
},
1000
);
}])
.
controller
(
'detailsMetricsCtrl'
,
[
'$scope'
,
'$stateParams'
,
'Application'
,
'ApplicationDetails'
,
'Abbreviator'
,
function
(
$scope
,
$stateParams
,
Application
,
ApplicationDetails
,
Abbreviator
)
{
.
controller
(
'detailsMetricsCtrl'
,
[
'$scope'
,
'$stateParams'
,
'Application'
,
'ApplicationDetails'
,
'Abbreviator'
,
'MetricsHelper'
,
function
(
$scope
,
$stateParams
,
Application
,
ApplicationDetails
,
Abbreviator
,
MetricsHelper
)
{
$scope
.
memoryData
=
[];
$scope
.
heapMemoryData
=
[];
$scope
.
counterData
=
[];
...
...
@@ -97,54 +102,17 @@ angular.module('springBootAdmin')
{
key
:
"max"
,
values
:
[]
},
{
key
:
"count"
,
values
:
[]
}
];
for
(
var
metric
in
application
.
metrics
)
{
var
matchCounter
=
/counter
\.(
.+
)
/
.
exec
(
metric
);
if
(
matchCounter
!==
null
)
{
$scope
.
counterData
[
0
].
values
.
push
([
matchCounter
[
1
],
application
.
metrics
[
metric
]
]);
continue
;
}
var
matchGaugeValue
=
/gauge
\.(
.+
)\.
val/
.
exec
(
metric
);
if
(
matchGaugeValue
!==
null
)
{
$scope
.
gaugeData
[
0
].
values
.
push
([
matchGaugeValue
[
1
],
application
.
metrics
[
metric
]
]);
continue
;
}
var
matchGaugeAvg
=
/gauge
\.(
.+
)\.
avg/
.
exec
(
metric
);
if
(
matchGaugeAvg
!==
null
)
{
$scope
.
gaugeData
[
1
].
values
.
push
([
matchGaugeAvg
[
1
],
application
.
metrics
[
metric
]
]);
continue
;
}
var
matchGaugeMin
=
/gauge
\.(
.+
)\.
min/
.
exec
(
metric
);
if
(
matchGaugeMin
!==
null
)
{
$scope
.
gaugeData
[
2
].
values
.
push
([
matchGaugeMin
[
1
],
application
.
metrics
[
metric
]
]);
continue
;
}
var
matchGaugeMax
=
/gauge
\.(
.+
)\.
max/
.
exec
(
metric
);
if
(
matchGaugeMax
!==
null
)
{
$scope
.
gaugeData
[
3
].
values
.
push
([
matchGaugeMax
[
1
],
application
.
metrics
[
metric
]
]);
continue
;
}
var
matchGaugeCount
=
/gauge
\.(
.+
)\.
count/
.
exec
(
metric
);
if
(
matchGaugeCount
!==
null
)
{
$scope
.
gaugeData
[
4
].
values
.
push
([
matchGaugeCount
[
1
],
application
.
metrics
[
metric
]
]);
continue
;
}
var
matchGaugeAlpha
=
/gauge
\.(
.+
)\.
alpha/
.
exec
(
metric
);
if
(
matchGaugeAlpha
!==
null
)
{
continue
;
}
var
matchGaugeValue
=
/gauge
\.(
.+
)
/
.
exec
(
metric
);
if
(
matchGaugeValue
!==
null
)
{
$scope
.
gaugeData
[
0
].
values
.
push
([
matchGaugeValue
[
1
],
application
.
metrics
[
metric
]
]);
}
}
MetricsHelper
.
find
(
application
.
metrics
,
[
/counter
\.(
.+
)
/
,
/gauge
\.(
.+
)\.
val/
,
/gauge
\.(
.+
)\.
avg/
,
/gauge
\.(
.+
)\.
min/
,
/gauge
\.(
.+
)\.
max/
,
/gauge
\.(
.+
)\.
count/
,
/gauge
\.(
.+
)\.
alpha/
,
/gauge
\.(
.+
)
/
],
[
function
(
metric
,
match
,
value
)
{
$scope
.
counterData
[
0
].
values
.
push
([
match
[
1
],
value
]);
},
function
(
metric
,
match
,
value
)
{
$scope
.
gaugeData
[
0
].
values
.
push
([
match
[
1
],
value
]);
},
function
(
metric
,
match
,
value
)
{
$scope
.
gaugeData
[
1
].
values
.
push
([
match
[
1
],
value
]);
},
function
(
metric
,
match
,
value
)
{
$scope
.
gaugeData
[
2
].
values
.
push
([
match
[
1
],
value
]);
},
function
(
metric
,
match
,
value
)
{
$scope
.
gaugeData
[
3
].
values
.
push
([
match
[
1
],
value
]);
},
function
(
metric
,
match
,
value
)
{
$scope
.
gaugeData
[
4
].
values
.
push
([
match
[
1
],
value
]);
},
function
(
metric
,
match
,
value
)
{
/*NOP*/
},
function
(
metric
,
match
,
value
)
{
$scope
.
gaugeData
[
0
].
values
.
push
([
match
[
1
],
value
]);
}]);
//in case no richGauges are present remove empty groups
var
i
=
$scope
.
gaugeData
.
length
;
while
(
--
i
)
{
...
...
spring-boot-admin-server/src/main/webapp/public/scripts/services/services.js
View file @
3a1499dd
...
...
@@ -340,4 +340,17 @@ angular.module('springBootAdmin.services', ['ngResource'])
this
.
list
=
function
(
url
)
{
return
outer
.
request
(
url
,
{
type
:
'list'
});
}
}])
.
service
(
'MetricsHelper'
,
[
function
()
{
this
.
find
=
function
(
metrics
,
regexes
,
callbacks
)
{
for
(
var
metric
in
metrics
)
{
for
(
var
i
in
regexes
)
{
var
match
=
regexes
[
i
].
exec
(
metric
);
if
(
match
!=
null
)
{
callbacks
[
i
](
metric
,
match
,
metrics
[
metric
]);
break
;
}
}
}
}
}]);
spring-boot-admin-server/src/main/webapp/public/views/apps/details.html
View file @
3a1499dd
...
...
@@ -35,7 +35,7 @@
</tr>
<tr>
<td>
Threads
</td>
<td>
{{ application.metrics['threads'] }} total / {{ application.metrics['threads.daemon'] }} daemon
</td>
<td>
{{ application.metrics['threads'] }} total / {{ application.metrics['threads.daemon'] }} daemon
/ {{ application.metrics['threads.peak'] }} peak
</td>
</tr>
</tbody>
</table>
...
...
@@ -82,17 +82,35 @@
<table
class=
"table"
>
<thead><tr><th
colspan=
"2"
>
Garbage Collection
</th></tr></thead>
<tr
ng-repeat-start=
"(name, value) in gcInfos track by name"
>
<td>
{{name | capitalize}} Count
</td>
<td>
{{name | capitalize}}
GC
Count
</td>
<td>
{{value.count}}
</td>
</tr>
<tr
ng-repeat-end
>
<td>
{{name | capitalize}} Time
</td>
<td>
{{name | capitalize}}
GC
Time
</td>
<td>
{{value.time}} ms
</td>
</tr>
</tbody>
</table>
</div>
<div
class=
"span6"
ng-show=
"hasDatasources"
>
<table
class=
"table"
>
<thead><tr><th
colspan=
"2"
>
Datasources
</th></tr></thead>
<tr
ng-repeat =
"(name, value) in datasources track by name"
>
<td
colspan=
"2"
>
<span>
{{name | capitalize}} Datasource Connections (active: {{ value.active }})
</span>
<div
class=
"progress"
style=
"margin-bottom: 0px;"
>
<div
class=
"bar"
style=
"width:{{ value.usage * 100 | number:0 }}%;"
ng-class=
"{'bar-success': value.usage < 0.75, 'bar-warning': value.usage >= 0.75 && value.usage < 0.95, 'bar-danger': value.usage >= 0.95}"
>
{{value.usage * 100 | number}}%
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div
class=
"span12"
>
<div
class=
"main-template"
>
<div
id=
"xd-jobs"
class=
"tab-pane active col-md-12"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment