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
5e6f4b8e
Commit
5e6f4b8e
authored
Jan 25, 2018
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adapt to trace changes in snapshot
parent
ee4f43f7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
51 deletions
+30
-51
index.vue
...rver-ui/src/main/frontend/views/instances/trace/index.vue
+18
-33
traces-chart.vue
.../src/main/frontend/views/instances/trace/traces-chart.vue
+7
-13
traces-list.vue
...i/src/main/frontend/views/instances/trace/traces-list.vue
+5
-5
No files found.
spring-boot-admin-server-ui/src/main/frontend/views/instances/trace/index.vue
View file @
5e6f4b8e
...
@@ -86,59 +86,44 @@
...
@@ -86,59 +86,44 @@
:
(
val
,
key
)
=>
oldFilter
(
val
,
key
)
&&
addedFilter
(
val
,
key
);
:
(
val
,
key
)
=>
oldFilter
(
val
,
key
)
&&
addedFilter
(
val
,
key
);
class
Trace
{
class
Trace
{
constructor
({
timestamp
,
info
})
{
constructor
({
timestamp
,
...
trace
})
{
this
.
info
=
info
;
Object
.
assign
(
this
,
trace
)
;
this
.
timestamp
=
moment
(
timestamp
);
this
.
timestamp
=
moment
(
timestamp
);
}
}
get
key
()
{
get
key
()
{
return
`
${
this
.
timestamp
}
-
${
this
.
method
}
-
${
this
.
path
}
`
;
return
`
${
this
.
timestamp
}
-
${
this
.
request
.
method
}
-
${
this
.
request
.
uri
}
`
;
}
get
method
()
{
return
this
.
info
.
method
;
}
get
path
()
{
return
this
.
info
.
path
;
}
get
status
()
{
return
this
.
info
.
headers
.
response
.
status
;
}
get
timeTaken
()
{
const
timeTaken
=
this
.
info
.
timeTaken
;
if
(
timeTaken
&&
/^
\d
+$/
.
test
(
timeTaken
))
{
return
parseInt
(
timeTaken
);
}
}
}
get
contentLength
()
{
get
contentLength
()
{
const
contentLength
=
this
.
info
.
headers
.
response
[
'Content-Length'
];
const
contentLength
=
this
.
response
.
headers
[
'Content-Length'
]
&&
this
.
response
.
headers
[
'Content-Length'
][
0
];
if
(
contentLength
&&
/^
\d
+$/
.
test
(
contentLength
))
{
if
(
contentLength
&&
/^
\d
+$/
.
test
(
contentLength
))
{
return
parseInt
(
contentLength
);
return
parseInt
(
contentLength
);
}
}
}
}
get
contentType
()
{
get
contentType
()
{
const
contentType
=
this
.
info
.
headers
.
response
[
'Content-Type'
];
const
contentType
=
this
.
response
.
headers
[
'Content-Type'
]
&&
this
.
response
.
headers
[
'Content-Type'
][
0
];
if
(
contentType
)
{
if
(
contentType
)
{
const
idx
=
contentType
.
indexOf
(
';'
);
const
idx
=
contentType
.
indexOf
(
';'
);
return
idx
>=
0
?
contentType
.
substring
(
0
,
idx
)
:
contentType
;
return
idx
>=
0
?
contentType
.
substring
(
0
,
idx
)
:
contentType
;
}
}
}
}
compareTo
(
other
)
{
return
this
.
timestamp
-
other
.
timestamp
;
}
isSuccess
()
{
isSuccess
()
{
return
this
.
status
<=
2
99
return
this
.
response
.
status
<=
3
99
}
}
isClientError
()
{
isClientError
()
{
return
this
.
status
>=
400
&&
this
.
status
<=
499
return
this
.
response
.
status
>=
400
&&
this
.
response
.
status
<=
499
}
}
isServerError
()
{
isServerError
()
{
return
this
.
status
>=
500
&&
this
.
status
<=
599
return
this
.
response
.
status
>=
500
&&
this
.
response
.
status
<=
599
}
}
}
}
...
@@ -187,9 +172,10 @@
...
@@ -187,9 +172,10 @@
methods
:
{
methods
:
{
async
fetchTrace
()
{
async
fetchTrace
()
{
const
response
=
await
this
.
instance
.
fetchTrace
();
const
response
=
await
this
.
instance
.
fetchTrace
();
const
traces
=
response
.
data
.
traces
.
filter
(
const
traces
=
response
.
data
.
traces
.
map
(
trace
=>
new
Trace
(
trace
)).
filter
(
trace
=>
moment
(
trace
.
timestamp
)
.
isAfter
(
this
.
lastTimestamp
)
trace
=>
trace
.
timestamp
.
isAfter
(
this
.
lastTimestamp
)
);
);
traces
.
sort
((
a
,
b
)
=>
-
1
*
a
.
compareTo
(
b
));
if
(
traces
.
length
>
0
)
{
if
(
traces
.
length
>
0
)
{
this
.
lastTimestamp
=
traces
[
0
].
timestamp
;
this
.
lastTimestamp
=
traces
[
0
].
timestamp
;
}
}
...
@@ -202,8 +188,7 @@
...
@@ -202,8 +188,7 @@
return
Observable
.
timer
(
0
,
5000
)
return
Observable
.
timer
(
0
,
5000
)
.
concatMap
(
vm
.
fetchTrace
)
.
concatMap
(
vm
.
fetchTrace
)
.
subscribe
({
.
subscribe
({
next
:
rawTraces
=>
{
next
:
traces
=>
{
const
traces
=
rawTraces
.
map
(
trace
=>
new
Trace
(
trace
));
vm
.
traces
=
vm
.
traces
?
traces
.
concat
(
vm
.
traces
)
:
traces
;
vm
.
traces
=
vm
.
traces
?
traces
.
concat
(
vm
.
traces
)
:
traces
;
},
},
errors
:
err
=>
{
errors
:
err
=>
{
...
@@ -215,11 +200,11 @@
...
@@ -215,11 +200,11 @@
getFilterFn
()
{
getFilterFn
()
{
let
filterFn
=
null
;
let
filterFn
=
null
;
if
(
this
.
actuatorPath
!==
null
&&
this
.
excludeActuator
)
{
if
(
this
.
actuatorPath
!==
null
&&
this
.
excludeActuator
)
{
filterFn
=
addToFilter
(
filterFn
,
(
trace
)
=>
trace
.
path
.
indexOf
(
this
.
actuatorPath
)
!==
0
);
filterFn
=
addToFilter
(
filterFn
,
(
trace
)
=>
trace
.
request
.
uri
.
indexOf
(
this
.
actuatorPath
)
<
0
);
}
}
if
(
this
.
filter
)
{
if
(
this
.
filter
)
{
const
normalizedFilter
=
this
.
filter
.
toLowerCase
();
const
normalizedFilter
=
this
.
filter
.
toLowerCase
();
filterFn
=
addToFilter
(
filterFn
,
(
trace
)
=>
trace
.
path
.
toLowerCase
().
indexOf
(
normalizedFilter
)
>=
0
);
filterFn
=
addToFilter
(
filterFn
,
(
trace
)
=>
trace
.
request
.
uri
.
toLowerCase
().
indexOf
(
normalizedFilter
)
>=
0
);
}
}
if
(
!
this
.
showSuccess
)
{
if
(
!
this
.
showSuccess
)
{
filterFn
=
addToFilter
(
filterFn
,
(
trace
)
=>
!
trace
.
isSuccess
());
filterFn
=
addToFilter
(
filterFn
,
(
trace
)
=>
!
trace
.
isSuccess
());
...
...
spring-boot-admin-server-ui/src/main/frontend/views/instances/trace/traces-chart.vue
View file @
5e6f4b8e
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
//see https://github.com/d3/d3/issues/2733#issuecomment-190743489
//see https://github.com/d3/d3/issues/2733#issuecomment-190743489
import
d3
from
'@/utils/d3'
;
import
d3
from
'@/utils/d3'
;
import
{
event
as
d3Event
}
from
'd3-selection'
;
import
{
event
as
d3Event
}
from
'd3-selection'
;
import
moment
from
'moment
-shortformat
'
;
import
moment
from
'moment'
;
const
interval
=
1000
;
const
interval
=
1000
;
export
default
{
export
default
{
...
@@ -71,12 +71,12 @@
...
@@ -71,12 +71,12 @@
const
chartData
=
[];
const
chartData
=
[];
const
now
=
moment
.
now
().
valueOf
();
const
now
=
moment
.
now
().
valueOf
();
let
idx
=
this
.
traces
.
length
-
1
;
let
idx
=
this
.
traces
.
length
-
1
;
const
oldest
=
this
.
traces
[
this
.
traces
.
length
-
1
].
timestamp
;
const
oldest
=
this
.
traces
[
this
.
traces
.
length
-
1
].
timestamp
.
valueOf
()
;
for
(
let
time
=
Math
.
floor
(
oldest
.
valueOf
()
/
interval
)
*
interval
;
time
<
now
;
time
+=
interval
)
{
for
(
let
time
=
Math
.
floor
(
oldest
.
valueOf
()
/
interval
)
*
interval
;
time
<
now
;
time
+=
interval
)
{
const
bucket
=
{
const
bucket
=
{
timeStart
:
new
Date
(
time
)
,
timeStart
:
time
,
timeEnd
:
new
Date
(
time
+
interval
)
,
timeEnd
:
time
+
interval
,
totalCount
:
0
,
totalCount
:
0
,
totalSuccess
:
0
,
totalSuccess
:
0
,
totalClientErrors
:
0
,
totalClientErrors
:
0
,
...
@@ -90,11 +90,9 @@
...
@@ -90,11 +90,9 @@
bucket
.
totalCount
++
;
bucket
.
totalCount
++
;
if
(
trace
.
isSuccess
())
{
if
(
trace
.
isSuccess
())
{
bucket
.
totalSuccess
++
;
bucket
.
totalSuccess
++
;
}
}
else
if
(
trace
.
isClientError
())
{
if
(
trace
.
isClientError
())
{
bucket
.
totalClientErrors
++
;
bucket
.
totalClientErrors
++
;
}
}
else
if
(
trace
.
isServerError
())
{
if
(
trace
.
isServerError
())
{
bucket
.
totalServerErrors
++
;
bucket
.
totalServerErrors
++
;
}
}
if
(
trace
.
timeTaken
)
{
if
(
trace
.
timeTaken
)
{
...
@@ -117,8 +115,6 @@
...
@@ -117,8 +115,6 @@
bucket
=>
bucket
.
timeStart
.
valueOf
()
>=
selection
[
0
]
&&
bucket
.
timeStart
.
valueOf
()
<
selection
[
1
]
bucket
=>
bucket
.
timeStart
.
valueOf
()
>=
selection
[
0
]
&&
bucket
.
timeStart
.
valueOf
()
<
selection
[
1
]
).
reduce
(
).
reduce
(
(
current
,
next
)
=>
({
(
current
,
next
)
=>
({
timeStart
:
new
Date
(
Math
.
min
(
current
.
timeStart
.
valueOf
(),
next
.
timeStart
.
valueOf
())),
timeEnd
:
new
Date
(
Math
.
max
(
current
.
timeEnd
.
valueOf
(),
next
.
timeEnd
.
valueOf
())),
totalCount
:
current
.
totalCount
+
next
.
totalCount
,
totalCount
:
current
.
totalCount
+
next
.
totalCount
,
totalSuccess
:
current
.
totalSuccess
+
next
.
totalSuccess
,
totalSuccess
:
current
.
totalSuccess
+
next
.
totalSuccess
,
totalClientErrors
:
current
.
totalClientErrors
+
next
.
totalClientErrors
,
totalClientErrors
:
current
.
totalClientErrors
+
next
.
totalClientErrors
,
...
@@ -127,8 +123,6 @@
...
@@ -127,8 +123,6 @@
maxTime
:
Math
.
max
(
current
.
maxTime
,
next
.
maxTime
)
maxTime
:
Math
.
max
(
current
.
maxTime
,
next
.
maxTime
)
}),
}),
{
{
timeStart
:
new
Date
(
selection
[
0
]),
timeEnd
:
new
Date
(
selection
[
1
]),
totalCount
:
0
,
totalCount
:
0
,
totalSuccess
:
0
,
totalSuccess
:
0
,
totalClientErrors
:
0
,
totalClientErrors
:
0
,
...
@@ -175,7 +169,7 @@
...
@@ -175,7 +169,7 @@
//draw axis
//draw axis
vm
.
xAxis
.
call
(
d3
.
axisBottom
(
x
)
vm
.
xAxis
.
call
(
d3
.
axisBottom
(
x
)
.
ticks
(
10
)
.
ticks
(
10
)
.
tickFormat
(
d
=>
`-
${
moment
(
d
).
short
(
true
)}
`
)
.
tickFormat
(
d
=>
moment
(
d
).
format
(
"HH:mm:ss"
)
)
);
);
vm
.
yAxis
.
call
(
d3
.
axisRight
(
y
)
vm
.
yAxis
.
call
(
d3
.
axisRight
(
y
)
...
...
spring-boot-admin-server-ui/src/main/frontend/views/instances/trace/traces-list.vue
View file @
5e6f4b8e
...
@@ -33,10 +33,10 @@
...
@@ -33,10 +33,10 @@
@click="showDetails[trace.key] ? $delete(showDetails, trace.key) : $set(showDetails, trace.key, true)"
@click="showDetails[trace.key] ? $delete(showDetails, trace.key) : $set(showDetails, trace.key, true)"
:key="trace.key">
:key="trace.key">
<td
v-text=
"trace.timestamp.format('L HH:mm:ss.SSS')"
></td>
<td
v-text=
"trace.timestamp.format('L HH:mm:ss.SSS')"
></td>
<td
v-text=
"trace.method"
></td>
<td
v-text=
"trace.
request.
method"
></td>
<td
v-text=
"trace.
path
"
></td>
<td
v-text=
"trace.
request.uri
"
></td>
<td>
<td>
<span
v-text=
"trace.status"
class=
"tag"
<span
v-text=
"trace.
response.
status"
class=
"tag"
:class=
"
{ 'is-success' : trace.isSuccess(), 'is-warning' : trace.isClientError(), 'is-danger' : trace.isServerError() }">
</span>
:class=
"
{ 'is-success' : trace.isSuccess(), 'is-warning' : trace.isClientError(), 'is-danger' : trace.isServerError() }">
</span>
</td>
</td>
<td
v-text=
"trace.contentType"
></td>
<td
v-text=
"trace.contentType"
></td>
...
@@ -45,12 +45,12 @@
...
@@ -45,12 +45,12 @@
</tr>
</tr>
<tr
class=
"trace__detail"
:key=
"`$
{trace.key}-detail`" v-if="showDetails[trace.key]">
<tr
class=
"trace__detail"
:key=
"`$
{trace.key}-detail`" v-if="showDetails[trace.key]">
<td
colspan=
"7"
>
<td
colspan=
"7"
>
<pre
v-text=
"toJson(trace
.info
)"
></pre>
<pre
v-text=
"toJson(trace)"
></pre>
</td>
</td>
</tr>
</tr>
</
template
>
</
template
>
<tr
v-if=
"traces.length === 0"
>
<tr
v-if=
"traces.length === 0"
>
<td
class=
"is-muted"
colspan=
"
5
"
>
No traces found.
</td>
<td
class=
"is-muted"
colspan=
"
7
"
>
No traces found.
</td>
</tr>
</tr>
</table>
</table>
</template>
</template>
...
...
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