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
a241cb7d
Commit
a241cb7d
authored
Feb 19, 2018
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle non epoch timestamp in trace-legacy converter
parent
25f4003f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
3 deletions
+21
-3
LegacyEndpointConverters.java
...oot/admin/server/web/client/LegacyEndpointConverters.java
+19
-1
httptrace-expected.json
...tric/boot/admin/server/web/client/httptrace-expected.json
+1
-1
httptrace-legacy.json
...entric/boot/admin/server/web/client/httptrace-legacy.json
+1
-1
No files found.
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/web/client/LegacyEndpointConverters.java
View file @
a241cb7d
...
...
@@ -20,7 +20,10 @@ import de.codecentric.boot.admin.server.domain.values.Endpoint;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
java.time.DateTimeException
;
import
java.time.Instant
;
import
java.time.OffsetDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.LinkedHashMap
;
...
...
@@ -54,6 +57,8 @@ public class LegacyEndpointConverters {
};
private
static
final
Jackson2JsonDecoder
DECODER
;
private
static
final
Jackson2JsonEncoder
ENCODER
;
private
static
final
DateTimeFormatter
TIMESTAMP_PATTERN
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd'T'HH:mm:ss.SSSZ"
);
static
{
ObjectMapper
om
=
Jackson2ObjectMapperBuilder
.
json
()
...
...
@@ -157,7 +162,7 @@ public class LegacyEndpointConverters {
@SuppressWarnings
(
"unchecked"
)
private
static
Map
<
String
,
Object
>
convertHttptrace
(
Map
<
String
,
Object
>
in
)
{
Map
<
String
,
Object
>
out
=
new
LinkedHashMap
<>();
out
.
put
(
"timestamp"
,
Instant
.
ofEpochMilli
((
Long
)
in
.
get
(
"timestamp"
)));
out
.
put
(
"timestamp"
,
getInstant
(
in
.
get
(
"timestamp"
)));
Map
<
String
,
Object
>
in_info
=
(
Map
<
String
,
Object
>)
in
.
get
(
"info"
);
if
(
in_info
!=
null
)
{
Map
<
String
,
Object
>
request
=
new
LinkedHashMap
<>();
...
...
@@ -254,4 +259,17 @@ public class LegacyEndpointConverters {
return
converted
;
}).
collect
(
toList
());
}
private
static
Instant
getInstant
(
Object
o
)
{
try
{
if
(
o
instanceof
String
)
{
return
OffsetDateTime
.
parse
((
String
)
o
,
TIMESTAMP_PATTERN
).
toInstant
();
}
else
if
(
o
instanceof
Long
)
{
return
Instant
.
ofEpochMilli
((
Long
)
o
);
}
}
catch
(
DateTimeException
|
ClassCastException
e
)
{
return
null
;
}
return
null
;
}
}
spring-boot-admin-server/src/test/resources/de/codecentric/boot/admin/server/web/client/httptrace-expected.json
View file @
a241cb7d
...
...
@@ -43,7 +43,7 @@
"timeTaken"
:
2
},
{
"timestamp"
:
"2018-02-
04T21:58:45.290
Z"
,
"timestamp"
:
"2018-02-
19T17:34:51.207
Z"
,
"request"
:
{
"method"
:
"GET"
,
"uri"
:
""
,
...
...
spring-boot-admin-server/src/test/resources/de/codecentric/boot/admin/server/web/client/httptrace-legacy.json
View file @
a241cb7d
...
...
@@ -24,7 +24,7 @@
}
},
{
"timestamp"
:
1517781525290
,
"timestamp"
:
"2018-02-19T17:34:51.207+0000"
,
"info"
:
{
"method"
:
"GET"
,
"path"
:
""
,
...
...
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