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
b82480a8
Commit
b82480a8
authored
Jun 29, 2017
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix: fix missing metrics
fixes #479
parent
e5754cb4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
90 deletions
+89
-90
metricsCtrl.js
...i/modules/applications-metrics/controllers/metricsCtrl.js
+89
-90
No files found.
spring-boot-admin-server-ui/modules/applications-metrics/controllers/metricsCtrl.js
View file @
b82480a8
/*
* Copyright 2014 the original author or authors.
* Copyright 2014
-2017
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
* 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,
...
...
@@ -17,121 +17,120 @@
module
.
exports
=
function
(
$scope
,
application
)
{
'ngInject'
;
var
metricData
=
{
'gauge'
:
[]};
var
metricDataMax
=
{
'gauge'
:
0
};
$scope
.
showRichGauges
=
false
;
$scope
.
metrics
=
[];
application
.
getMetrics
().
then
(
function
(
response
)
{
function
merge
(
array
,
obj
)
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
if
(
array
[
i
].
name
===
obj
.
name
)
{
for
(
var
a
in
obj
)
{
array
[
i
][
a
]
=
obj
[
a
];
}
return
;
function
merge
(
array
,
obj
)
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
if
(
array
[
i
].
name
===
obj
.
name
)
{
for
(
var
a
in
obj
)
{
if
(
obj
.
hasOwnProperty
(
a
))
{
array
[
i
][
a
]
=
obj
[
a
];
}
}
array
.
push
(
obj
)
;
return
;
}
}
array
.
push
(
obj
);
}
var
find
=
function
(
metrics
,
regexes
,
callbacks
)
{
for
(
var
metric
in
metrics
)
{
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
;
}
}
}
}
application
.
getMetrics
().
then
(
function
(
response
)
{
var
metricData
=
{};
for
(
var
key
in
metricData
)
{
if
(
metricData
.
hasOwnProperty
(
key
))
{
$scope
.
metrics
.
push
({
name
:
key
,
values
:
metricData
[
key
],
max
:
metricDataMax
[
key
]
||
0
});
}
function
addData
(
groupname
,
valueObj
,
max
)
{
var
group
=
metricData
[
groupname
]
||
{
max
:
0
,
values
:
[]};
merge
(
group
.
values
,
valueObj
);
if
(
typeof
max
!==
'undefined'
&&
max
>
group
.
max
)
{
group
.
max
=
max
;
}
};
var
regexes
=
[
/^
(?!
gauge
)([
a-zA-Z0-9
]
+
)\.
.*/gi
,
/
(
gauge
\.
.+
)\.
val/
,
/
(
gauge
\.
.+
)\.
avg/
,
/
(
gauge
\.
.+
)\.
min/
,
/
(
gauge
\.
.+
)\.
max/
,
/
(
gauge
\.
.+
)\.
count/
,
/
(
gauge
\.
.+
)\.
alpha/
,
/
(
gauge
\.
.+
)
/
];
var
callbacks
=
[
function
(
metric
,
match
,
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
});
metricData
[
groupname
]
=
group
;
}
if
(
value
>
metricDataMax
[
match
[
1
]])
{
metricDataMax
[
match
[
1
]]
=
value
;
}
}
},
function
(
metric
,
match
,
value
)
{
merge
(
metricData
[
'gauge'
],
{
var
matchers
=
[{
regex
:
/
(
gauge
\.
.+
)\.
val/
,
callback
:
function
(
metric
,
match
,
value
)
{
addData
(
'gauge'
,
{
name
:
match
[
1
],
value
:
value
});
}
,
value
);
$scope
.
showRichGauges
=
true
;
if
(
value
>
metricDataMax
[
'gauge'
])
{
metricDataMax
[
'gauge'
]
=
value
;
}
},
function
(
metric
,
match
,
value
)
{
merge
(
metricData
[
'gauge'
],
{
}
},
{
regex
:
/
(
gauge
\.
.+
)\.
avg/
,
callback
:
function
(
metric
,
match
,
value
)
{
addData
(
'gauge'
,
{
name
:
match
[
1
],
avg
:
value
.
toFixed
(
2
)
});
},
function
(
metric
,
match
,
value
)
{
merge
(
metricData
[
'gauge'
],
{
}
},
{
regex
:
/
(
gauge
\.
.+
)\.
min/
,
callback
:
function
(
metric
,
match
,
value
)
{
addData
(
'gauge'
,
{
name
:
match
[
1
],
min
:
value
});
},
function
(
metric
,
match
,
value
)
{
merge
(
metricData
[
'gauge'
],
{
}
},
{
regex
:
/
(
gauge
\.
.+
)\.
max/
,
callback
:
function
(
metric
,
match
,
value
)
{
addData
(
'gauge'
,
{
name
:
match
[
1
],
max
:
value
});
if
(
value
>
metricDataMax
[
'gauge'
])
{
metricDataMax
[
'gauge'
]
=
value
;
}
},
function
(
metric
,
match
,
value
)
{
merge
(
metricData
[
'gauge'
],
{
},
value
);
}
},
{
regex
:
/
(
gauge
\.
.+
)\.
count/
,
callback
:
function
(
metric
,
match
,
value
)
{
addData
(
'gauge'
,
{
name
:
match
[
1
],
count
:
value
});
},
function
()
{
/* NOP */
},
function
(
metric
,
match
,
value
)
{
merge
(
metricData
[
'gauge'
],
{
}
},
{
regex
:
/
(
gauge
\.
.+
)\.
alpha/
,
callback
:
function
()
{
/* NOP */
}
},
{
regex
:
/
(
gauge
\.
.+
)
/
,
callback
:
function
(
metric
,
match
,
value
)
{
addData
(
'gauge'
,
{
name
:
match
[
1
],
value
:
value
});
if
(
value
>
metricDataMax
[
'gauge'
])
{
metricDataMax
[
'gauge'
]
=
value
;
}
}];
},
value
);
}
},
{
regex
:
/^
([^
.
]
+
)
.*/
,
callback
:
function
(
metric
,
match
,
value
)
{
addData
(
match
[
1
],
{
name
:
metric
,
value
:
value
},
value
);
}
}];
find
(
response
.
data
,
regexes
,
callbacks
);
var
metrics
=
response
.
data
;
for
(
var
metric
in
metrics
)
{
if
(
metrics
.
hasOwnProperty
(
metric
))
{
for
(
var
i
=
0
;
i
<
matchers
.
length
;
i
++
)
{
var
match
=
matchers
[
i
].
regex
.
exec
(
metric
);
if
(
match
!==
null
)
{
matchers
[
i
].
callback
(
metric
,
match
,
metrics
[
metric
]);
break
;
}
}
}
}
for
(
var
groupname
in
metricData
)
{
if
(
metricData
.
hasOwnProperty
(
groupname
))
{
$scope
.
metrics
.
push
({
name
:
groupname
,
values
:
metricData
[
groupname
].
values
,
max
:
metricData
[
groupname
].
max
||
0
});
}
}
}
).
catch
(
function
(
response
)
{
$scope
.
error
=
response
.
data
;
...
...
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