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
668d19c1
Commit
668d19c1
authored
Nov 25, 2017
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return null on missing version
Don't output metadata in Registration.toString()
parent
d76e16c8
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
34 deletions
+35
-34
application.yml
...ring-boot-admin-sample/src/main/resources/application.yml
+1
-21
Info.java
.../de/codecentric/boot/admin/server/domain/values/Info.java
+1
-1
Registration.java
...centric/boot/admin/server/domain/values/Registration.java
+3
-0
InstanceRegistry.java
...ecentric/boot/admin/server/services/InstanceRegistry.java
+1
-1
ApplicationsController.java
...centric/boot/admin/server/web/ApplicationsController.java
+9
-5
InstancesController.java
...odecentric/boot/admin/server/web/InstancesController.java
+19
-5
InfoTest.java
...codecentric/boot/admin/server/domain/values/InfoTest.java
+1
-1
No files found.
spring-boot-admin-samples/spring-boot-admin-sample/src/main/resources/application.yml
View file @
668d19c1
...
...
@@ -11,10 +11,10 @@ management:
endpoints
:
web
:
base-path
:
"
/actuator"
expose
:
"
*"
jolokia
:
enabled
:
true
spring
:
application
:
name
:
"
@pom.artifactId@"
...
...
@@ -26,26 +26,6 @@ spring:
active
:
-
insecure
endpoints
:
health
:
enabled
:
true
metrics
:
enabled
:
true
logfile
:
enabled
:
true
loggers
:
enabled
:
true
trace
:
enabled
:
true
auditevents
:
enabled
:
true
heapdump
:
enabled
:
true
threaddump
:
enabled
:
true
env
:
enabled
:
true
---
spring
:
profiles
:
insecure
...
...
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/domain/values/Info.java
View file @
668d19c1
...
...
@@ -57,7 +57,7 @@ public class Info implements Serializable {
if
(
version
instanceof
String
)
{
return
(
String
)
version
;
}
return
""
;
return
null
;
}
@JsonAnyGetter
...
...
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/domain/values/Registration.java
View file @
668d19c1
...
...
@@ -16,6 +16,8 @@
package
de
.
codecentric
.
boot
.
admin
.
server
.
domain
.
values
;
import
lombok.ToString
;
import
java.io.IOException
;
import
java.io.Serializable
;
import
java.net.URI
;
...
...
@@ -44,6 +46,7 @@ import com.fasterxml.jackson.databind.ser.std.StdSerializer;
*/
@lombok
.
Data
@JsonDeserialize
(
using
=
Registration
.
Deserializer
.
class
)
@ToString
(
exclude
=
"metadata"
)
public
class
Registration
implements
Serializable
{
private
final
String
name
;
private
final
String
managementUrl
;
...
...
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/services/InstanceRegistry.java
View file @
668d19c1
...
...
@@ -53,7 +53,7 @@ public class InstanceRegistry {
instance
=
Instance
.
create
(
key
);
}
return
Mono
.
just
(
instance
.
register
(
registration
));
}).
then
(
Mono
.
just
(
id
)
);
}).
map
(
Instance:
:
getId
);
}
/**
...
...
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/web/ApplicationsController.java
View file @
668d19c1
...
...
@@ -50,12 +50,11 @@ import static java.util.stream.Collectors.toMap;
@ResponseBody
public
class
ApplicationsController
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
ApplicationsController
.
class
);
private
static
final
ServerSentEvent
<?>
PING
=
ServerSentEvent
.
builder
().
comment
(
"ping"
).
build
();
private
static
final
Flux
<
ServerSentEvent
<?>>
PING_FLUX
=
Flux
.
interval
(
Duration
.
ZERO
,
Duration
.
ofSeconds
(
10L
))
.
map
(
tick
->
PING
);
private
final
InstanceRegistry
registry
;
private
final
InstanceEventPublisher
eventPublisher
;
private
static
final
ServerSentEvent
<
Application
>
PING
=
ServerSentEvent
.<
Application
>
builder
().
comment
(
"ping"
)
.
build
();
private
static
final
Flux
<
ServerSentEvent
<
Application
>>
PING_FLUX
=
Flux
.
interval
(
Duration
.
ZERO
,
Duration
.
ofSeconds
(
10L
)).
map
(
tick
->
PING
);
public
ApplicationsController
(
InstanceRegistry
registry
,
InstanceEventPublisher
eventPublisher
)
{
this
.
registry
=
registry
;
...
...
@@ -77,7 +76,7 @@ public class ApplicationsController {
.
map
(
this
::
getApplicationForInstance
)
.
flatMap
(
group
->
toApplication
(
group
.
getT1
(),
group
.
getT2
()))
.
map
(
application
->
ServerSentEvent
.
builder
(
application
).
build
())
.
mergeWith
(
PING_FLUX
);
.
mergeWith
(
ping
()
);
}
@DeleteMapping
(
path
=
"/applications/{name}"
)
...
...
@@ -152,6 +151,11 @@ public class ApplicationsController {
.
orElse
(
Tuples
.
of
(
StatusInfo
.
STATUS_UNKNOWN
,
-
1L
));
}
@SuppressWarnings
(
"unchecked"
)
private
static
<
T
>
Flux
<
ServerSentEvent
<
T
>>
ping
()
{
return
(
Flux
<
ServerSentEvent
<
T
>>)
(
Flux
)
PING_FLUX
;
}
@lombok
.
Data
public
static
class
Application
{
private
final
String
name
;
...
...
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/web/InstancesController.java
View file @
668d19c1
...
...
@@ -66,13 +66,12 @@ import static org.springframework.web.reactive.function.client.WebClient.Request
@ResponseBody
public
class
InstancesController
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
InstancesController
.
class
);
private
static
final
ServerSentEvent
<
InstanceEvent
>
PING
=
ServerSentEvent
.<
InstanceEvent
>
builder
().
comment
(
"ping"
)
.
build
();
private
static
final
ServerSentEvent
<?>
PING
=
ServerSentEvent
.
builder
().
comment
(
"ping"
).
build
();
private
static
final
Flux
<
ServerSentEvent
<?>>
PING_FLUX
=
Flux
.
interval
(
Duration
.
ZERO
,
Duration
.
ofSeconds
(
10L
))
.
map
(
tick
->
(
ServerSentEvent
<?>)
PING
);
private
final
InstanceRegistry
registry
;
private
final
InstanceEventStore
eventStore
;
private
final
InstanceWebClient
instanceWebClient
;
private
static
final
Flux
<
ServerSentEvent
<
InstanceEvent
>>
PING_FLUX
=
Flux
.
interval
(
Duration
.
ZERO
,
Duration
.
ofSeconds
(
10L
)).
map
(
tick
->
PING
);
public
InstancesController
(
InstanceRegistry
registry
,
InstanceEventStore
eventStore
,
...
...
@@ -151,7 +150,16 @@ public class InstancesController {
@GetMapping
(
path
=
"/instances/events"
,
produces
=
MediaType
.
TEXT_EVENT_STREAM_VALUE
)
public
Flux
<
ServerSentEvent
<
InstanceEvent
>>
eventStream
()
{
return
Flux
.
from
(
eventStore
).
map
(
event
->
ServerSentEvent
.
builder
(
event
).
build
()).
mergeWith
(
PING_FLUX
);
return
Flux
.
from
(
eventStore
).
map
(
event
->
ServerSentEvent
.
builder
(
event
).
build
()).
mergeWith
(
ping
());
}
@GetMapping
(
path
=
"/instances/{id}"
,
produces
=
MediaType
.
TEXT_EVENT_STREAM_VALUE
)
public
Flux
<
ServerSentEvent
<
Instance
>>
instanceStream
(
@PathVariable
String
id
)
{
return
Flux
.
from
(
eventStore
)
.
filter
(
event
->
event
.
getInstance
().
equals
(
InstanceId
.
of
(
id
)))
.
flatMap
(
event
->
registry
.
getInstance
(
event
.
getInstance
()))
.
map
(
event
->
ServerSentEvent
.
builder
(
event
).
build
())
.
mergeWith
(
ping
());
}
private
static
final
String
[]
HOP_BY_HOP_HEADERS
=
new
String
[]{
"Connection"
,
"Keep-Alive"
,
"Proxy-Authenticate"
,
...
...
@@ -204,4 +212,10 @@ public class InstancesController {
return
false
;
}
}
@SuppressWarnings
(
"unchecked"
)
private
static
<
T
>
Flux
<
ServerSentEvent
<
T
>>
ping
()
{
return
(
Flux
<
ServerSentEvent
<
T
>>)
(
Flux
)
PING_FLUX
;
}
}
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/server/domain/values/InfoTest.java
View file @
668d19c1
...
...
@@ -35,7 +35,7 @@ public class InfoTest {
@Test
public
void
should_return_version
()
{
assertThat
(
Info
.
empty
().
getVersion
()).
is
EqualTo
(
""
);
assertThat
(
Info
.
empty
().
getVersion
()).
is
Null
(
);
assertThat
(
Info
.
from
(
singletonMap
(
"version"
,
"1.0.0"
)).
getVersion
()).
isEqualTo
(
"1.0.0"
);
assertThat
(
Info
.
from
(
singletonMap
(
"build"
,
singletonMap
(
"version"
,
"1.0.0"
))).
getVersion
()).
isEqualTo
(
"1.0.0"
);
...
...
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