Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
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
DEMO
spring-boot
Commits
c578a30e
Commit
c578a30e
authored
May 05, 2018
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
ea2a98d0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
34 deletions
+27
-34
caches.adoc
...tor-autoconfigure/src/main/asciidoc/endpoints/caches.adoc
+0
-8
integrationgraph.adoc
...nfigure/src/main/asciidoc/endpoints/integrationgraph.adoc
+0
-3
WebClientMetricsAutoConfiguration.java
...trics/web/reactive/WebClientMetricsAutoConfiguration.java
+0
-1
CachesEndpoint.java
...rg/springframework/boot/actuate/cache/CachesEndpoint.java
+20
-15
IntegrationGraphEndpoint.java
...rk/boot/actuate/integration/IntegrationGraphEndpoint.java
+3
-2
IntegrationGraphEndpointTests.java
...ot/actuate/integration/IntegrationGraphEndpointTests.java
+4
-5
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/asciidoc/endpoints/caches.adoc
View file @
c578a30e
...
...
@@ -7,7 +7,6 @@ The `caches` endpoint provides access to the application's caches.
[[caches-all]]
== Retrieving All Caches
To retrieve the application's caches, make a `GET` request to `/actuator/caches`, as
shown in the following curl-based example:
...
...
@@ -21,7 +20,6 @@ include::{snippets}caches/all/http-response.adoc[]
[[caches-all-response-structure]]
=== Response Structure
The response contains details of the application's caches. The following table describes
the structure of the response:
...
...
@@ -32,7 +30,6 @@ include::{snippets}caches/all/response-fields.adoc[]
[[caches-named]]
== Retrieving Caches by Name
To retrieve a cache by name, make a `GET` request to `/actuator/caches/{name}`,
as shown in the following curl-based example:
...
...
@@ -47,7 +44,6 @@ include::{snippets}caches/named/http-response.adoc[]
[[caches-named-request-structure]]
=== Request Structure
If the requested name is specific enough to identify a single cache, no extra parameter is
required. Otherwise, the `cacheManager` must be specified. The following table shows the
supported query parameters:
...
...
@@ -59,7 +55,6 @@ include::{snippets}caches/named/request-parameters.adoc[]
[[caches-named-response-structure]]
=== Response Structure
The response contains details of the requested cache. The following table describes the
structure of the response:
...
...
@@ -70,7 +65,6 @@ include::{snippets}caches/named/response-fields.adoc[]
[[caches-evict-all]]
== Evict All Caches
To clear all available caches, make a `DELETE` request to `/actuator/caches` as shown in
the following curl-based example:
...
...
@@ -80,7 +74,6 @@ include::{snippets}caches/evict-all/curl-request.adoc[]
[[caches-evict-named]]
== Evict a Cache by Name
To evict a particular cache, make a `DELETE` request to `/actuator/caches/{name}` as shown
in the following curl-based example:
...
...
@@ -93,7 +86,6 @@ specify which `Cache` should be cleared.
[[caches-evict-named-request-structure]]
=== Request Structure
If the requested name is specific enough to identify a single cache, no extra parameter is
required. Otherwise, the `cacheManager` must be specified. The following table shows the
supported query parameters:
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/asciidoc/endpoints/integrationgraph.adoc
View file @
c578a30e
...
...
@@ -8,7 +8,6 @@ components.
[[integrationgraph-retrieving]]
== Retrieving the Spring Integration graph
To retrieve the information about the application, make a `GET` request to
`/actuator/integrationgraph`, as shown in the following curl-based example:
...
...
@@ -22,7 +21,6 @@ include::{snippets}integrationgraph/graph/http-response.adoc[]
[[integrationgraph-retrieving-response-structure]]
=== Response Structure
The response contains all Spring Integration components used within the application, as
well as the links between them. More information about the structure can be found in the
https://docs.spring.io/spring-integration/reference/html/system-management-chapter.html#integration-graph[reference
...
...
@@ -32,7 +30,6 @@ documentation].
[[integrationgraph-rebuilding]]
== Rebuilding the Spring Integration graph
To rebuild the exposed graph, make a `POST` request to `/actuator/integrationgraph`, as
shown in the following curl-based example:
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/reactive/WebClientMetricsAutoConfiguration.java
View file @
c578a30e
...
...
@@ -39,7 +39,6 @@ import org.springframework.web.reactive.function.client.WebClient;
/**
* {@link EnableAutoConfiguration Auto-configuration} for instrumentation of
* {@link org.springframework.web.reactive.function.client.WebClient}.
*
* <p>
* This is reusing the {@link io.micrometer.core.instrument.config.MeterFilter} defined in
* {@link RestTemplateMetricsAutoConfiguration} for limiting the cardinality of "uri"
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/CachesEndpoint.java
View file @
c578a30e
...
...
@@ -59,11 +59,13 @@ public class CachesEndpoint {
@ReadOperation
public
CachesReport
caches
()
{
Map
<
String
,
Map
<
String
,
CacheDescriptor
>>
descriptors
=
new
LinkedHashMap
<>();
getCacheEntries
((
name
)
->
true
,
(
cacheManager
)
->
true
).
forEach
((
entry
)
->
{
Map
<
String
,
CacheDescriptor
>
cmDescriptors
=
descriptors
.
computeIfAbsent
(
entry
.
getCacheManager
(),
(
key
)
->
new
LinkedHashMap
<>());
String
cache
=
entry
.
getName
();
cmDescriptors
.
put
(
cache
,
new
CacheDescriptor
(
entry
.
getTarget
()));
getCacheEntries
(
matchAll
(),
matchAll
()).
forEach
((
entry
)
->
{
String
cacheName
=
entry
.
getName
();
String
cacheManager
=
entry
.
getCacheManager
();
Map
<
String
,
CacheDescriptor
>
cacheManagerDescriptors
=
descriptors
.
computeIfAbsent
(
cacheManager
,
(
key
)
->
new
LinkedHashMap
<>());
cacheManagerDescriptors
.
put
(
cacheName
,
new
CacheDescriptor
(
entry
.
getTarget
()));
});
return
new
CachesReport
(
descriptors
);
}
...
...
@@ -79,7 +81,7 @@ public class CachesEndpoint {
@ReadOperation
public
CacheEntry
cache
(
@Selector
String
cache
,
@Nullable
String
cacheManager
)
{
return
extractUniqueCacheEntry
(
cache
,
getCacheEntries
((
name
)
->
name
.
equals
(
cache
),
safeEqual
(
cacheManager
)));
getCacheEntries
((
name
)
->
name
.
equals
(
cache
),
isNameMatch
(
cacheManager
)));
}
/**
...
...
@@ -87,14 +89,13 @@ public class CachesEndpoint {
*/
@DeleteOperation
public
void
clearCaches
()
{
getCacheEntries
((
name
)
->
true
,
(
cacheManagerName
)
->
true
)
.
forEach
(
this
::
clearCache
);
getCacheEntries
(
matchAll
(),
matchAll
()).
forEach
(
this
::
clearCache
);
}
/**
* Clear the specific {@link Cache}.
* @param cache then name of the cache
* @param cacheManager the name of the cacheManager (can be {@code null}
* @param cacheManager the name of the cacheManager (can be {@code null}
to match all)
* @return {@code true} if the cache was cleared or {@code false} if no such cache
* exists
* @throws NonUniqueCacheException if more than one cache with that name exist and no
...
...
@@ -102,7 +103,7 @@ public class CachesEndpoint {
@DeleteOperation
public
boolean
clearCache
(
@Selector
String
cache
,
@Nullable
String
cacheManager
)
{
CacheEntry
entry
=
extractUniqueCacheEntry
(
cache
,
getCacheEntries
((
name
)
->
name
.
equals
(
cache
),
safeEqual
(
cacheManager
)));
getCacheEntries
((
name
)
->
name
.
equals
(
cache
),
isNameMatch
(
cacheManager
)));
return
(
entry
!=
null
&&
clearCache
(
entry
));
}
...
...
@@ -131,12 +132,13 @@ public class CachesEndpoint {
entries
.
stream
().
map
(
CacheEntry:
:
getCacheManager
).
distinct
()
.
collect
(
Collectors
.
toList
()));
}
return
(
entries
.
isEmpty
()
?
null
:
entries
.
get
(
0
)
);
return
(
!
entries
.
isEmpty
()
?
entries
.
get
(
0
)
:
null
);
}
private
boolean
clearCache
(
CacheEntry
entry
)
{
String
cacheName
=
entry
.
getName
();
Cache
cache
=
this
.
cacheManagers
.
get
(
entry
.
getCacheManager
()).
getCache
(
cacheName
);
String
cacheManager
=
entry
.
getCacheManager
();
Cache
cache
=
this
.
cacheManagers
.
get
(
cacheManager
).
getCache
(
cacheName
);
if
(
cache
!=
null
)
{
cache
.
clear
();
return
true
;
...
...
@@ -144,9 +146,12 @@ public class CachesEndpoint {
return
false
;
}
private
Predicate
<
String
>
safeEqual
(
String
name
)
{
return
(
name
!=
null
?
((
requested
)
->
requested
.
equals
(
name
))
:
((
requested
)
->
true
));
private
Predicate
<
String
>
isNameMatch
(
String
name
)
{
return
(
name
!=
null
?
((
requested
)
->
requested
.
equals
(
name
))
:
matchAll
());
}
private
Predicate
<
String
>
matchAll
()
{
return
(
name
)
->
true
;
}
/**
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/integration/IntegrationGraphEndpoint.java
View file @
c578a30e
...
...
@@ -34,8 +34,9 @@ public class IntegrationGraphEndpoint {
private
final
IntegrationGraphServer
graphServer
;
/**
* Create a new {@code IntegrationGraphEndpoint} that exposes a graph containing all
* the Spring Integration components in the given {@link IntegrationGraphServer}.
* Create a new {@code IntegrationGraphEndpoint} instance that exposes a graph
* containing all the Spring Integration components in the given
* {@link IntegrationGraphServer}.
* @param graphServer the integration graph server
*/
public
IntegrationGraphEndpoint
(
IntegrationGraphServer
graphServer
)
{
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/integration/IntegrationGraphEndpointTests.java
View file @
c578a30e
...
...
@@ -26,9 +26,9 @@ import org.springframework.integration.support.management.graph.Graph;
import
org.springframework.integration.support.management.graph.IntegrationGraphServer
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
BDDMockito
.
mock
;
import
static
org
.
mockito
.
BDDMockito
.
verify
;
import
static
org
.
mockito
.
BDDMockito
.
when
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
/**
* Tests for {@link IntegrationGraphEndpoint}.
...
...
@@ -51,8 +51,7 @@ public class IntegrationGraphEndpointTests {
@Test
public
void
readOperationShouldReturnGraph
()
{
Graph
mockedGraph
=
mock
(
Graph
.
class
);
when
(
this
.
integrationGraphServer
.
getGraph
()).
thenReturn
(
mockedGraph
);
given
(
this
.
integrationGraphServer
.
getGraph
()).
willReturn
(
mockedGraph
);
Graph
graph
=
this
.
integrationGraphEndpoint
.
graph
();
verify
(
this
.
integrationGraphServer
).
getGraph
();
assertThat
(
graph
).
isEqualTo
(
mockedGraph
);
...
...
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