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
82d707e6
Commit
82d707e6
authored
May 04, 2017
by
coestre
Committed by
Johannes Edmeier
Jun 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify the metrics page to show up more values
With this commit all values from /metrics are shown and a option to filter these values is provided closes #264
parent
1430d941
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
56 deletions
+72
-56
metricsCtrl.js
...i/modules/applications-metrics/controllers/metricsCtrl.js
+50
-30
metrics.html
...server-ui/modules/applications-metrics/views/metrics.html
+22
-26
No files found.
spring-boot-admin-server-ui/modules/applications-metrics/controllers/metricsCtrl.js
View file @
82d707e6
...
...
@@ -18,11 +18,10 @@
module
.
exports
=
function
(
$scope
,
application
)
{
'ngInject'
;
$scope
.
counters
=
[];
$scope
.
countersMax
=
0
;
$scope
.
gauges
=
[];
$scope
.
gaugesMax
=
0
;
var
metricData
=
{
'gauge'
:
[]};
var
metricDataMax
=
{
'gauge'
:
0
};
$scope
.
showRichGauges
=
false
;
$scope
.
metrics
=
[];
application
.
getMetrics
().
then
(
function
(
response
)
{
...
...
@@ -40,78 +39,99 @@ module.exports = function ($scope, application) {
var
find
=
function
(
metrics
,
regexes
,
callbacks
)
{
for
(
var
metric
in
metrics
)
{
for
(
var
i
=
0
;
i
<
regexes
.
length
;
i
++
)
{
var
match
=
regexes
[
i
].
exec
(
metric
);
if
(
match
!==
null
)
{
callbacks
[
i
](
metric
,
match
,
metrics
[
metric
]);
break
;
if
(
metrics
.
hasOwnProperty
(
metric
))
{
for
(
var
i
=
0
;
i
<
regexes
.
length
;
i
++
)
{
var
match
=
regexes
[
i
].
exec
(
metric
);
if
(
match
!==
null
)
{
callbacks
[
i
](
metric
,
match
,
metrics
[
metric
]);
break
;
}
}
}
}
for
(
var
key
in
metricData
)
{
if
(
metricData
.
hasOwnProperty
(
key
))
{
$scope
.
metrics
.
push
({
name
:
key
,
values
:
metricData
[
key
],
max
:
metricDataMax
[
key
]
||
0
});
}
}
};
var
regexes
=
[
/^
(?!
gauge
)([
a-zA-Z0-9
]
+
)\.
.*/gi
,
/
(
gauge
\.
.+
)\.
val/
,
/
(
gauge
\.
.+
)\.
avg/
,
/
(
gauge
\.
.+
)\.
min/
,
/
(
gauge
\.
.+
)\.
max/
,
/
(
gauge
\.
.+
)\.
count/
,
/
(
gauge
\.
.+
)\.
alpha/
,
/
(
gauge
\.
.+
)
/
];
var
regexes
=
[
/counter
\.
.+/
,
/
(
gauge
\.
.+
)\.
val/
,
/
(
gauge
\.
.+
)\.
avg/
,
/
(
gauge
\.
.+
)\.
min/
,
/
(
gauge
\.
.+
)\.
max/
,
/
(
gauge
\.
.+
)\.
count/
,
/
(
gauge
\.
.+
)\.
alpha/
,
/
(
gauge
\.
.+
)
/
];
var
callbacks
=
[
function
(
metric
,
match
,
value
)
{
$scope
.
counters
.
push
({
name
:
metric
,
value
:
value
});
if
(
value
>
$scope
.
countersMax
)
{
$scope
.
countersMax
=
value
;
if
(
typeof
metricData
[
match
[
1
]]
===
'undefined'
){
metricData
[
match
[
1
]]
=
[];
}
if
(
typeof
metricDataMax
[
match
[
1
]]
===
'undefined'
){
metricDataMax
[
match
[
1
]]
=
0
;
}
if
(
match
.
length
>=
2
&&
match
[
1
]
!==
null
)
{
metricData
[
match
[
1
]].
push
({
name
:
metric
,
value
:
value
});
if
(
value
>
metricDataMax
[
match
[
1
]])
{
metricDataMax
[
match
[
1
]]
=
value
;
}
}
},
function
(
metric
,
match
,
value
)
{
merge
(
$scope
.
gauges
,
{
merge
(
metricData
[
'gauge'
]
,
{
name
:
match
[
1
],
value
:
value
});
$scope
.
showRichGauges
=
true
;
if
(
value
>
$scope
.
gaugesMax
)
{
$scope
.
gaugesMax
=
value
;
if
(
value
>
metricDataMax
[
'gauge'
]
)
{
metricDataMax
[
'gauge'
]
=
value
;
}
},
function
(
metric
,
match
,
value
)
{
merge
(
$scope
.
gauges
,
{
merge
(
metricData
[
'gauge'
]
,
{
name
:
match
[
1
],
avg
:
value
.
toFixed
(
2
)
});
},
function
(
metric
,
match
,
value
)
{
merge
(
$scope
.
gauges
,
{
merge
(
metricData
[
'gauge'
]
,
{
name
:
match
[
1
],
min
:
value
});
},
function
(
metric
,
match
,
value
)
{
merge
(
$scope
.
gauges
,
{
merge
(
metricData
[
'gauge'
]
,
{
name
:
match
[
1
],
max
:
value
});
if
(
value
>
$scope
.
gaugesMax
)
{
$scope
.
gaugesMax
=
value
;
if
(
value
>
metricDataMax
[
'gauge'
]
)
{
metricDataMax
[
'gauge'
]
=
value
;
}
},
function
(
metric
,
match
,
value
)
{
merge
(
$scope
.
gauges
,
{
merge
(
metricData
[
'gauge'
]
,
{
name
:
match
[
1
],
count
:
value
});
},
function
()
{
/* NOP */
},
function
()
{
/* NOP */
},
function
(
metric
,
match
,
value
)
{
merge
(
$scope
.
gauges
,
{
merge
(
metricData
[
'gauge'
]
,
{
name
:
match
[
1
],
value
:
value
});
if
(
value
>
$scope
.
gaugesMax
)
{
$scope
.
gaugesMax
=
value
;
if
(
value
>
metricDataMax
[
'gauge'
]
)
{
metricDataMax
[
'gauge'
]
=
value
;
}
}];
find
(
response
.
data
,
regexes
,
callbacks
);
}
).
catch
(
function
(
response
)
{
$scope
.
error
=
response
.
data
;
...
...
spring-boot-admin-server-ui/modules/applications-metrics/views/metrics.html
View file @
82d707e6
<div
class=
"container"
>
<div
class=
"alert alert-error"
ng-if=
"error"
>
<b>
Error:
</b>
{{ error }}
</div>
<sba-info-panel
panel-title=
"Counter"
raw=
"api/applications/{{ application.id }}/metrics/counter.*"
>
<table
class=
"table"
ng-if=
"counters.length > 0"
>
<tr
ng-repeat=
"counter in counters"
>
<td>
<sba-simple-metric-bar
for-metric=
"counter"
global-max=
"countersMax"
></sba-simple-metric-bar>
</td>
</tr>
</table>
</sba-info-panel>
<sba-info-panel
panel-title=
"Gauges"
raw=
"api/applications/{{ application.id }}/metrics/gauge.*"
>
<table
class=
"table"
ng-if=
"gauges.length > 0"
>
<tr
ng-if=
"showRichGauges"
ng-repeat=
"gauge in gauges"
>
<td>
<sba-rich-metric-bar
for-metric=
"gauge"
global-max=
"gaugesMax"
></sba-rich-metric-bar>
</td>
</tr>
<tr
ng-if=
"!showRichGauges"
ng-repeat=
"gauge in gauges"
>
<td>
<sba-simple-metric-bar
for-metric=
"gauge"
global-max=
"gaugesMax"
></sba-simple-metric-bar>
</td>
</tr>
</table>
</sba-info-panel>
<div
class=
"alert alert-error"
ng-if=
"error"
>
<b>
Error:
</b>
{{ error }}
</div>
<div>
<input
placeholder=
"Filter"
class=
"input-xxlarge"
type=
"search"
ng-model=
"searchFilter"
/>
</div>
<sba-info-panel
ng-repeat=
"metric in metrics | orderBy:'name'"
panel-title=
"{{ metric.name }}"
raw=
"api/applications/{{ application.id }}/metrics/{{ metric.name }}.*"
ng-show=
"!searchFilter || (metric.values | filter:searchFilter).length > 0"
>
<table
class=
"table"
>
<tr
ng-if=
"showRichGauges"
ng-repeat=
"m in metric.values | filter:searchFilter"
>
<td>
<sba-rich-metric-bar
for-metric=
"m"
global-max=
"metric.max"
></sba-rich-metric-bar>
</td>
</tr>
<tr
ng-if=
"!showRichGauges"
ng-repeat=
"m in metric.values | filter:searchFilter"
>
<td>
<sba-simple-metric-bar
for-metric=
"m"
global-max=
"metric.max"
></sba-simple-metric-bar>
</td>
</tr>
</table>
</sba-info-panel>
</div>
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